FedoraForum.org - Fedora Support Forums and Community
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2011
    Posts
    203
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Systemd slow in NFS mounting

    My new PC boots slow. Via systemd-analyse I have established that this comes from mounting two NFS-shares which run on a NAS in my own network. By default they take 60 seconds to mount! This is surprising as my previous PC (~7 year lot slower hardware; running Mandriva 2010.2) mounted these in a few seconds; mounting them manyally from command-line mounts them in a few seconds. Further digging shows that the exact time spends on this is dependant on the value of timeo in /etc/fstab. The deafult of this is 600 (deciseconds, i.e. 60 seconds). Reducing this to 50 causes the mount command to complete in 5 seconds; to 100 in 10 seconds etc). Yet man nfs suggests to me that the timeo value is teh maximum time until which nfs tries mounting.

    The workstation is a vanilla Fedora 16 X86-64 implementation; the NAS runs under Debian (Etch I believe -- a bubba box). Anybody who can help to trouble shoot this?

  2. #2
    Join Date
    Aug 2009
    Posts
    11,390
    Mentioned
    98 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    It appears that it's not actually mounting your nfs shares at boot time, and is actually timing out, then it's going back and re-trying the mount later and that is when they actually get mounted.

    on my system here, the nfs mounts take anywhere from 68ms to 187ms, and it actually faster than a couple of the local filesystem mounts (one is 238ms)

    You possibly may be running into the problem where network services get fired off and try to start before the network is actually up and settled. This happens if you are using Network Manager (The default in F16).

    There are a couple of things you need to do if you use network manager, but wish to have the network available at boot time. You need to configure network manager (in your network settings) to connect automatically and be available to all users. If you don't then it will wait until a user signs in to bring up the network.

    Also, even when you have it configured to start at boot, there is an issue with the network servicees getting fired off too soon.

    a workaround is to enable the NetworkManager-wait-online.service

    Code:
    systemctl enable NetworkManager-wait-online.service

  3. #3
    Join Date
    Dec 2011
    Posts
    203
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    This sounds promising. Network manager was already configured as you describe, but I will give NM-wait-online a try.. I vaguely recall from the bootlog that some bnetwork activity started indeed early; not sure whether this explains the slow NFS mount sthough as systemd-analyse plots puts these towards the end. Will report back.

  4. #4
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    That is part of the problem of using a thundering herd sheduling.

    NFS servers used to do that, causing NFS daemons to have CPU spikes when all NFS daemons were signaled that a request was in. Now it is a FIFO so that such spikes don't happen, and operation is much more efficient.

    We now have an even bigger spike caused by systemd.

    Using the wait-online.service should help, but it doesn't guarantee success (there have been some reports of it still failing... sometimes), but it has been a while since these were reported. Other services can also cause this problem - DNS for instance. If your DNS server doesn't wait, it will delay... and if NFS then requests a name lookup (frequent) that isn't in your local host table... then it will delay NFS until a retry catches the DNS server having recovered...

    Also remember that Fedora has multiple name lookups (nss for one), LDAP, and others that may also be configured. If NFS uses any of these (and it may depend on when it uses it) these services may also cause timeouts...

    It is the same problem, just in a different place.

    Solutions for these others might require ensuring that they wait for the network, and have NFS wait for them (or require all of them when in doubt..)

  5. #5
    Join Date
    Aug 2009
    Posts
    11,390
    Mentioned
    98 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    True.

    I am just using a small network here, and it's easy to get around some of those issues by using the actual network address of the server rather than the server name and having to do a lookup. But if you are trying to maintain a larger network (doesn't even have to be very large at all), then that becomes next to impossible to do.

    as for the rest..

    Any idea when they are looking at getting systemd into RHEL? That will be the moment of truth (or death) for systemd.

  6. #6
    Join Date
    Dec 2011
    Posts
    203
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    Solved by adding 'noauto' to the options for both mounts in /etc/fstab and then mounting these by a script that gets called by rc.local. Systemd-analyse shows that rc.local only takes 800 ms (two mounts and a few other items), so NFS was never to blame.

  7. #7
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    You can also try adding "_netdev" to the fstab entry. Not sure how reliable that is though.

    And you don't know NFS was/was not the problem. NFS timeouts don't take any CPU, but they do take a long elapsed time.

  8. #8
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    A sort followup - The thread http://forums.fedoraforum.org/showth...25#post1552225 has a proper solution.

    Putting network mounts in rc.local may/may not work depending on what else can cause a sufficient delay allowing the network to actually be ready for use. It is indeterminate if it will always/mostly/sometimes work or fail.

  9. #9
    Join Date
    Dec 2011
    Posts
    203
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    Thanks for the additional info (though I think the URL is wrong - points to this thread and not another one). Could it be you refer to this one? I did try NetworkManager-wait-online.service but saw no change -- NFS still took 60s (the default timeout for NFS mounts) or in most cases whatever I put as value for timeo in the mount command.

    I realise that rc.local may be too early, but catch that by means of a script which retries a few times (with waiting times). Had to do this on a previous mandriva PC, where NFS mounts never worked from fstab (no link with systemd; its own parallelised boot got this wrong as well).

  10. #10
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Systemd slow in NFS mounting

    The one I was trying to link to showed that you need both _netdev in fstab entries AND ...wait-online.service.

    If you still have problems, then it is likely the name services must also be waited on.

    Most of the time I strongly recommend puting the NFS servers names in the /etc/hosts file... expecting named/ldap/nss/whatever to successfully navigate the problematical systemd scheduling just gets too hard to justify. If you must use named, you must have it wait for network services, and then have NFS wait for them.

    This is the problem systemd has - there are so many variations on dependencies that getting them right will be difficult and error prone. Combine that with problems getting system errors recorded properly (and attributed properly) makes it unreasonable.

    Putting things in rc.local doesn't make anything better - rc.local runs at the same time (or nearly) as everything else.

    There is no ordered dependency list guaranteed. They all must be listed explicitly or things just don't work.

Similar Threads

  1. A Journal Comes To systemd
    By tox in forum Linux Chat
    Replies: 0
    Last Post: 19th November 2011, 04:25 AM
  2. systemd is broken?
    By andrewthomas in forum F16 Development
    Replies: 3
    Last Post: 25th March 2011, 06:43 PM
  3. Systemd - Automount
    By jvillain in forum F16 Development
    Replies: 0
    Last Post: 8th January 2011, 09:55 PM
  4. systemd?
    By ssidhar in forum F14 Development
    Replies: 5
    Last Post: 29th September 2010, 07:11 PM
  5. slow speed when mounting NTFS
    By blobby in forum Using Fedora
    Replies: 4
    Last Post: 27th November 2006, 12:43 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •