Tuesday 19 January 2010

NFS mounts that hang with status "D"


You got a great Linux office going or maybe a network of servers working together. They share their drives and data through NFS mounts.

Then disaster happens! A NFS server goes down and every machine locks up! The machines trying to mount the NFS partition hang. The processes trying to access the NFS disk (probably your root partition) freeze and won't die!

The reason this happens is simple: A disastrous decision taken by Sun who developed NFS in the first place, compounded with distributions that simply haven't figured it out yet, means that NFS partitions are mounted, as a default, with the hard option. This tells the computer that it cannot function without that NFS mount ... so it hangs, trying and retrying forever to get that mount up and running.

Great for diskless work stations.

Horribly stupid for the real world!

Fortunately the solution is as easy as drinking a cappucino. Simply add the option soft into the /etc/fstab entry for the NFS mount. This tells NFS to try but not hang up. Adding bg into the options tells it to background the retries, meaning that reboots and mounts will keep the retries in the background allowing the machine to continue processing as normal.

Here is an example NFS line with
suitable options set:

/sms_team    nfs 
soft,bg,intr,timeo=10,retrans=2,retry=2,user,owner,exec,dev,suid,rw 0 0

Honeypot: spam@kieser.net

No comments:

Post a Comment