After yesterday’s WWDC session on Network Home Directories, two different people asked me if I had seen an issue with NFS mounts where a user would have a folder open, showing contents of items on an NFS share somewhere, and when they’d click on a item in the Finder window, it would just disappear.
As it turns out, we did see this issue about a year ago. It was quite confusing and frustrating. It seemed to be a Finder issue, because the items were still visible and accessible in the Terminal. We found that relaunching the Finder would cause the folder to regain all its items, but that was rather annoying. Finally, by accident, I discovered the cause and came up with a workaround.
First, a digression. In most places that use NFS shares, they are mounted via an automounter – autofs on most other UNIX-y platforms, and Apple’s automount on OS X Tiger and earlier. Automounters do not mount all the NFS shares they know about; they only mount them on demand – that is, as a path is accessed, it may trigger the automounter to mount the NFS share and make it available to the client. When the mount has been idle for some amount of time, the automounter quietly unmounts the NFS share. If the share is needed again in the future, the automounter simply remounts it. This generally works well.
Note that I mentioned that the automounter will unmount an idle share after some amount of time – this time is configurable. The default time in OS X Tiger is 3600 seconds, which is one hour. I had noticed that our Linux boxes were all configured to umount idle mounts after 900 seconds, or 15 minutes. When possible, I like to configure our Macs to behave similarly to our Linux boxes to make it easier for everyone. So I globally reconfigured all our Macs to unmount idle NFS mounts after 15 minutes.
Within a day, the phone calls to the help desk complaining about disappearing items in Finder windows had increased greatly. I sensed a correlation. I spoke to a few users, and reset their automount timeouts to an hour. They reported that the problem decreased noticably.
With these observations, I surmised that the Tiger Finder simply did not deal well with the automounter unmounting NFS shares. The workaround is to increase the “time-to-live” value for the automount – this is the “-tl” flag. I set it back to the default of 3600 seconds, you could set it higher if you wish.
Note that this workaround won’t actually prevent the problem from occurring – it will just reduce its occurrence.