Configuring NFS File Server for Home Directories
Assuming you're using a Unix or Linux file server, it is extremely straightforward to share out a home directory over NFS. Most Linux distributions install NFS by default and all that is necessary to start NFS is to configure /etc/exports and run something like:
There are a few Mac NFS oddities to be aware of that threw me for a loop when I first encountered them. One is that Mac-specific Linux NFS servers must use the insecure option when they export a file system. This is because OS X uses a weird port for NFS, and if you don't enable it you won't be able to mount NFS volumes and you'll wonder why. See Figure 6 for a CentOS /etc/exports configuration that works for Mac and Linux.
Figure 6. /etc/export example
Keep in mind, you can also quite easily share out a directory on your Open Directory server and use that to host common NFS home directories for Mac and Linux clients. This works just fine as well. Sharing out NFS volumes on OS X client or server is almost identical. Many people aren't aware that a regular, nonserver OS X machine can work well as an NFS file server. If you have one laying around, put it to use as an NFS file server. You'll find that SMB works just fine as well. I personally prefer to use Linux as an infrastructure file server because it is very cheap. An alternate corporate configuration could be a massive XSAN file server shared out over NFS that Open Directory uses for common NFS home directories. There are many ways to configure Open Directory and NFS; you just need to pick the right way for your situation.
Configuring Open Directory to Use an External NFS Volume for Home Directories
This section is the most complex section you will encounter in this three-part series, but I have included quite a few figures to try to make it clear. If you have any problems setting this up, don't feel bad, because it is very involved, and you can refer to the Open Directory online documentation, which is quite good.
Remember how I said that OS X has a few odd NFS implementations? Well, here is another oddity. The OS X implementation of NFS does not have something like
autofs, which is an extremely handy tool to automount file servers. For example, on Linux if you enable
autofs, you would just need to edit /etc/auto.master and uncomment the /net section as shown in Figure 7.
Figure 7. auto.master example
What is brilliant about using
autofs is that you will automatically get access to any NFS volume on the network by typing
ls -l /net/hostname of the file server you would like to mount. This means that you can make drastic changes to the NFS infrastructure and client-side configurations will not be needed, such as editing /etc/fstab.
On OS X there is a way to get around this by using Open Directory as an automount server. There is a Mounts container in Open Directory, which serves as a way to automount NFS volumes to bound Open Directory clients. This is extremely handy as it means you can explicitly define NFS file servers for all clients to mount.
Before you get too excited, there are a few gotchas. According to Apple, you should only mount between three to five file servers using this method. Additionally, you should modify the number of NFS daemons on your Open Directory Server so that it is above the default of six. I personally set this value to around 32 daemons, but you can go as high as 64 daemons if you have, say, 250 clients getting their NFS mounts this way. See Figure 8 for an example of changing NFS daemons default value.
Figure 8. Setting NFS daemons example