Getting NFS clients to retry mount if NFS server down when client boots

6,175

Solution 1

NFS is notoriously touchy when it comes to mounts being unavailable at mount time or mounts disappearing randomly. Particularly with older Linux releases, there were some very real and serious issues with both cases. Recent releases have gotten a lot better, but aren't yet perfect.

For this, however, I would strongly recommend looking into AutoFS and the automount daemon. This will cause the NFS shares to be mounted as needed, on demand. The advantages of this include not having to worry about whether the NFS server is available on startup, and the end stations not being affected if the NFS server disappears (provided they aren't actively using it at the time it goes away).

At my previous job, we made very heavy use of NFS, and once we migrated almost all of it over to automounts, it became enormously more useful, stable, and reliable. Also, recent releases of AutoFS (included in RHEL4+) allow you to pull your automount information from external sources, such as LDAP (this is really useful when you have a lot of machines mounting the same NFS shares, as you can make changes in one place and have all machines see the change).

Solution 2

The cron job solution is one way. Another is to use the automounter (autofs), and mount them on demand, although I've always suffered reliability problems with the automounter.

Solution 3

Automount should be your choice.

Share:
6,175

Related videos on Youtube

John
Author by

John

Linux/BSD/Solaris SysAdmin/Geek/Dad

Updated on September 17, 2022

Comments

  • John
    John almost 2 years

    I have an NFS server that several clients mount. I am using the following in my /etc/exports on the server:

    /content                *(rw,no_root_squash)
    

    and on the clients in my /etc/fstab I have:

    content.prd.domain.tld:/content /content         nfs     rw,hard,intr    0 0
    

    If the clients boot while the NFS server is down, the share does not get mounted. I read in the NFS man page that the retry defaults should handle this:

    retry=n The number of minutes to retry an NFS mount operation in the foreground or background before giving up. The default value for forground mounts is 2 minutes. The default value for background mounts is 10000 minutes, which is roughly one week.

    I have tested this, but it doesn't appear to work. Am I missing something?

    All servers are RHEL 5.4.

    Cheers z0mbix

    • warren
      warren over 14 years
      it's klugey, but you could run a cron job that would do a mount -a every X many minutes