NFS on Snow Leopard

I don't know what it is about Apple and NFS, but they keep moving things around. The new UI to NFS mounting is much nicer than it was before, but it's now in a totally different place: the Disk Utility. But if you use a lot of NFS file systems, it's a pain to have to mount them one by one: ignoring the UI and using the /net automount filesystem is far more convenient. Just use the file name /net/hostname/path and you don't have to mess with any mounting, it just happens by automagic. I wrote a blog entry about this a long time ago.

However, there is a huge problem with this: OS X does a phenominal amount of file locking (some would say, needlessly so) and has always been really sensitive to the configuration of locking on the NFS servers. So much so that if you randomly pick an NFS server in a large enterprise, true success is pretty unlikely. It'll succeed, but you'll keep getting messages indicating that the lock server is down, followed quickly by another message that the lock server is back up again. Even if you do get the NFS server tuned precisely the way that OS X wants it, performance sucks because of all the lock/unlock protocol requests that fly across the network. They clearly did something in Snow Leopard to aggravate this problem: it's now nasty enough to make NFS almost useless for me.

Fortunately, there is a fix: just turn off network locking. You can do it by adding the "nolocks,locallocks" options in the advanced options field of the Disk Utility NFS mounting UI, but this is painful if you do a lot of them, and doesn't help at all with /net. You can edit /etc/auto_master to add these options to the /net entry, but it doesn't affect other mounts - however I do recommend deleting the hidefromfinder option in auto_master. If you want to fix every automount, edit /etc/autofs.conf and search for the line that starts with AUTOMOUNTD_MNTOPTS=. These options get applied on every mount. Add nolocks,locallocks and your world will be faster and happier after you reboot.

August 29, 2009