A few notes on the way I have NFS set up at home.
- Each computer is both server and client; any computer is accessible (and fully trusted) from any other.
- The server side is set up in /etc/exports with a line like this:
/ canopus(rw,sync,nohide,no_subtree_check,fsid=1,no_root_squash) legend(rw,sync,nohide,no_subtree_check,fsid=1,no_root_squash)
listing each of the other computers in turn all on a single huge line. Computers with multiple mounted partitions have one line per partition, with a different fsid for each.
- The client side is set up in /etc/fstab with lines like this: legend:/ /legend nfs rsize=8192,wsize=8192,soft,bg canopus:/ /canopus nfs rsize=8192,wsize=8192,soft,bg
- There's a softlink for my own computer name in the root directory, so that I can use /legend on any computer, including legend itself.
- I've written a short script which called remount-nfs which is used whenever the network seems to be misbehaving. For one thing, normally one would power up the server first, then clients, but if each computer is both, there's no way to do that. Here's the script:
#!/bin/sh
sudo umount -l -a -t nfs
sudo mount -v -F -a -t nfs
The interesting options here are the -l "lazy" option to umount (which does the umount even if the directory is in use) and the -F "fork" option to mount (which does them all in parallel, so computers that are on-line get done and then it can wait for the others as long as it wants). Apart from that it does the obvious "have you tried to turn it off and on again" thing.
- To make remount-nfs easier to use, I sometimes add the following two lines to /etc/sudoers: %admin ALL=(ALL) NOPASSWD: /bin/umount -l -a -t nfs %admin ALL=(ALL) NOPASSWD: /bin/mount -v -F -a -t nfs which tell sudo not to ask for a password for these two particular command lines.
- On some computers (the server, which is rarely used interactively), I've put a variant of remount-nfs (without the sudo) in the /etc/cron.daily directory.
Remarks
- Instead of exporting /, I might have exported some other directory, maybe /home. However, sometimes other directories are also useful, eg parts of /var which may have MythTV recordings or Apache directories or other things; and /etc for copying config from one machine to another.
- Instead of mounting them in /, I probably should have made a directory for that (maybe /net/legend and /net/canopus or something).
- When a machine goes down, the timeout seems to be 10 minutes, which is faintly ridiculous on a LAN. However, with remount-nfs and rarely taking machines away, it seems to be OK.
⇦ Freight in the post-peak-oil world | ⇨ The Social Graph... |




