nfs hang when NAS shutsdown

lubuntu 12.10, home wireless net environment, Synology NAS

I have a NAS drive that has a scheduled start/shutdown to roughly coincide when we are at home. The NAS holds photos and music, and generally just is used for reads. My laptop automounts two shares on the NAS via nfs.

Problem is that if the NAS shuts down while my laptop is running, file manager just hangs and I can't do any saves/open of local laptop files from any applications. Shutting the laptop down causes shutdown to hang. Running 'mount' from terminal when the NAS box has shutdown shows the NAS mounts still there. Running 'sudo umount [nas mount]' just hangs.

I've read/re-read the nfs docs and googles, and thought I had it sussed, and have I've tried several things but can't solve this prob. Does anyone know how can I make the nfs mounted shares unmount gracefully if/when the NAS 'dies'??

Re: nfs hang when NAS shutsdown

It would be nice to know what you tried so we don't waste our time suggesting the same thing.

You should keep the mount options to a minimum and see if that helps, then add them back one by one. You have many, some which may be redundant (i.e. already default), others which may interfere with proper unmounting. I'm thinking of the bg option which would fork a new mount process on each fail, never letting go.

Re: nfs hang when NAS shutsdown

Hi Dusenberg.

This is what I do:

If nfs shares are on servers that are not 24/7, I don't use fixed mount points on the fstab. Instead, I use autofs (read about it here).

The default settings have a little better less freeze time that a fixed mount, but there's a way to get around it. If you use an indirect map that points to an executable script, you can have the opportunity to decide whether to mount the share if the server is up. You can use either 'ping' or 'map' to do that.