The client's root file system needs to include /bin /sbin /var /lib /usr /tmp /dev /etc /proc. In the interest of simplicity, /bin /sbin /var /lib /dev can be copies of the server's files. If you want to do this efficiently, install a complete distribution with all the bells and whistles you want in your clients on a machine with a disk, then copy the directories from there (or just use the disk in your server). You should be aware, however, that /etc /var /tmp /dev can't be shared between multiple clients.
If you wish to share /etc /var /tmp /dev between multiple clients (because you are really pressed for diskspace and/or bandwidth), you can mount those directories from the server to a temporary location, copy their contents onto ramdisks, and then mount those on /etc /var /tmp /dev. This will lose any client logs for you, too, and force you to be rather disciplined about software installation for the clients. The log problem can be taken care of by logging over the network, but that puts an additional strain on it, and you were pressed for bandwidth to begin with, remember?
/usr and /home should be shared between all clients. /usr can be exported read-only by the server.
If you want to actually use the /tmp directory, I really do not know a way around using a ramdisk. Insert the rd module (insmod rd
), create a second extended filesystem on /dev/ram (mke2fs /dev/ram
), and mount /dev/ram /tmp
. Then, set the permissions on /tmp correctly (chmod o
t /tmp+ comes to mind. You should also let anyone write there).
Make /etc/mtab a symlink to /proc/mounts. Strange things happen otherwise (mtab claimed I had mounted /dev/pts about a hundred times).
Also touch a file ``/fastboot''. This keeps the initialisation scripts from fsck'ing root during bootup. The alternative is to link /sbin/fsck.nfs to /bin/true.
You export the client's root filesystem from the server by using a line in /etc/exports like this:
<path to the client's root on the server> <client's IP>\ (rw,no_root_squash)
/etc/init.d/nfs-server reload
lets the changes take effect.
You may find it helps performance to play around with the NFS parameters. While you are forced to use blocksizes of less than 4096 bytes when mounting your swap partition, the other partitions can be mounted using any block sizes both server and client support. Here are some benchmarks obtained using dd, time and 512 million zeroes, all of which perished after the experiment:
blocksize | read-time | write-time |
default (4096?) | 56.1s | 68.9s |
8192 | 56.0s | 59.4s |
16384 | 56.2s | 62.0s |