NFS: unable to umount NFS share when server offline

Yes this is the nature of NFS. The clients will wait indefinitely for the NFS resource to come back. Believe it or not it's designed to work this way!

automounting

The better approach would probably be to use a tool such as autofs to automount the NFS shares as needed, rather than keep them mounted indefinitely.

Using just NFS

As @Patrick pointed out in the comments you can curtail this behavior by using the soft option when mounting NFS shares.

excerpt from source: http://www.tldp.org/HOWTO/NFS-HOWTO/client.html

soft

If a file request fails, the NFS client will report an error to the process on the client machine requesting the file access. Some programs can handle this with composure, most won't. We do not recommend using this setting; it is a recipe for corrupted files and lost data. You should especially not use this for mail disks --- if you value your mail, that is.

hard

The program accessing a file on a NFS mounted file system will hang when the server crashes. The process cannot be interrupted or killed (except by a "sure kill") unless you also specify intr. When the NFS server is back online the program will continue undisturbed from where it was. We recommend using hard,intr on all NFS mounted file systems.

In your /etc/fstab file

   # device             mountpoint  fs-type    options    dump fsckord
   ...
   master.foo.com:/home  /mnt/home   nfs      rw,soft  0     0
   ...

Tags:

Linux

Nfs