Optimizing NFS

July 24, 2004, updated August 8, 2004


I suppose the biggest optimization you can make to your NFS mount r/w speed is the rsize and wsize parameters. You can define them in your /etc/fstab file for a mount like this:

yourhost:/yourmount     /yourmount     nfs     rsize=8192,wsize=8192,timeo=14,intr

This little test will allow you to find the best block sizes to use for your existing network hardware and setup.

Simply run this a couple times:
time dd if=/mnt/test of=/dev/null bs=16k

Change your NFS mount rsize and wsize parameters in multiples of 1024 and make sure and remount the filesystem.

As always, use the nfsstat command and see if there are other network problems. Re-transmissions and dropped packets are what you're looking for. If NFS seems too slow, then I'd look at some underlying protocols and hardware. Other things you might want to consider are playing with kernel parameters and adjusting things like socket queue size.


It's a pretty big dispute- NFS security that is. I want to redirect you to a great page detailing some of the problems with what you might think would secure NFS- like NFS over SSH: http://nfs.sourceforge.net/nfs-howto/ Ultimately, really secure NFS on a public network with potentially malitious users is a pretty hard thing to do.

Related Posts