Vincent Danen outlines the steps to set up NFS mounts with the Disk Utility GUI in Mac OS X and offers some basic tips on configuration.
Mac OS X, being a UNIX-based operating system, can handle a number of file sharing protocols. It supports AFP, SMB, FTP, and NFS out of the box. For Mac-to-Mac file sharing, AFP is the best solution. For interoperation with Windows, SMB is best. For sharing files with Linux or other UNIX servers, using NFS is a great solution, but getting OS X set up as an NFS client can take a little trial and error.
With OS X 10.6, there are two ways to have your Mac set up as an NFS client. The first is to use the built-in automount setup, which allows you to automatically connect to hosts by accessing /net/[hostname]/, but this can be problematic. This uses the automountd daemon which is configured using the /etc/autofs.conf and /etc/auto_master configuration files.
For those familiar with UNIX, or in environments with a lot of regularly-accessed NFS mounts, it would be worth exploring setting up NFS mounts this way, but I have found it to be quite frustrating. Instead, use the Disk Utility GUI to set up individual NFS mounts. It is easier to configure, but becomes painful if there are a lot of NFS mounts to set up, as you must do them one by one.
To set up NFS this way:
1. Launch the Disk Utility application. In the menu bar, select File | NFS Mounts. A new window will open that lists any defined NFS mounts.
2. Select the “+” button at the bottom left of the window to add a new NFS mount.
3. For the remote NFS URL, use nfs://[hostname]/[export]; for example: nfs://fileserver.mydomain.com/srv.
4. For the local mount location, use something like /nfs/fileserver.
5. Expand the Advanced Mount Parameters section. Here you can pass some extra parameters to the NFS mount. The ideal value to place here is: resvport,nolocks,locallocks,intr,soft,wsize=32768,rsize=3276 (Look at the mount_nfs manpage for all of the available options and what they mean).
6. Click the Verify button and OS X will initiate a connection to the NFS server to make sure the settings are correct. When done, click Save.
At this point, you can navigate to /nfs/fileserver/ in the Terminal to deal with files, or you can use the Finder. The Finder won’t list these mounts like it does AFP or SMB; they won’t be listed under the SHARED section of the Finder sidebar. You can use the Finder to navigate to the path by going to the root device (i.e., the default Macintosh HD) and then opening the nfs folder, or wherever you specified the local mount. Any available NFS mounts will be noted there, and you can navigate the directory tree that way.
The nice thing about defining NFS mounts is that they are always available, because they are auto-mounted. So when you reboot the computer and then navigate to the defined folder, OS X will automatically initiate a connection to the NFS server.
Server-side, there is one important thing to note. There is a known issue with OS X where you must pass the insecure option to the defined host in the server’s /etc/exportfs configuration file:
NFS client support in OS X is not nearly as nice to set up or as graceful to use as it is on a Linux client, but it works well enough if you configure it properly. The key is the advanced mount options; without those options, setting up OS X as an NFS client will be more painful than it needs to be. But with them in place, using NFS on OS X can work quite well, and the always-available capabilities of the automounter are really handy.