Data Management

NFS: Making the Network File System work for you

In part 3 of 3, we'll show you how to set up the Client side of the system, and finally, how to increase NFS performance.


Setting up the client
Part 3 of 3
Now that you’ve set up your server, let’s tackle that client.

Setting up the client is always easier than setting up the server. For this configuration, you'll want to make sure that each user exists on each machine with the same UID. Then you'll need to decide if the remote file systems are to be mounted at boot time or not.

To mount a remote file system at boot time, place an entry in /etc/fstab with the name of the NFS server, the exported directory, and the directory where you want to mount the file system. Continuing our previous example, we'll mount the /var/spool/mail directory from the machine with the IP of 192.0.0.1 on our own local /var/spool/mail directory. Using the default mounting options for now (all available options are located in man 8 mount), the entry would look like this:
192.0.0.1:/var/spool/mail /var/spool/mail nfs  defaults 0 0

If you aren't sure what each field means, see the man page for fstab (man 5 fstab).

If you want to mount any NFS drives during boot time, you will need to make sure a link exists for a script between /etc/rc.d/rc3.d and /etc/rc.d/init.d/nfsfs. This script handles the mounting and un-mounting of NFS file systems. Again, create this link with an S and a number for a prefix to determine the order in which it runs when compared to other processes.

Improving performance
There are several things you can do to improve the performance of your NFS network. While the defaults do an admirable job of creating a working NFS implementation, they leave quite a bit to be desired when it comes to speed. The most obvious ways to speed up NFS accesses are hardware upgrades: a faster physical network such as Fast Ethernet, faster machines with higher-end CPU's and additional RAM, or very high speed SCSI drives. All of these can increase response time as well as decrease program load times and file access times.

Hardware upgrades
Hardware upgrades are expensive, and often don’t fall into a budget. Fortunately, there are also ways to use NFS options to improve your performance. Changing the line in the client's /etc/fstab to
192.0.0.1:/var/spool/mail /var/spool/mail nfs
rsize=8192,wsize=8192 0 0

can greatly increase NFS response times. This change increases the read and write buffers from the default of 1K to 8K, so fewer packets of NFS data are sent from client to server and vice-versa. Also, the manual pages for nfs, mountd, mount, fstab, and exports will show you other ways to improve the way NFS responds in your implementation. Each file system to export may be used for different purposes, and by making smart decisions on which options to use for each, you can quickly improve their performance.

Editor's Picks

Free Newsletters, In your Inbox