The purpose of this document is to keep track of the steps I performed in converting a computer which used to boot using dhcp/tftp/nfs into one that booted using its own local drive. Additionally, I am adding notes about things that, in hindsight, may have been easier.
I created this NFS root for booting a Soekris Embedded Device. (I used a net4801.) These instructions are based on the guide Mike Machado created Here, which was written for Debian Potato. Before continuing with these instructions, consider your own "why?", since the answers may change how you proceed.
A brief note on the language I'm using. The NFS root export directory will be called the "root filesystem area". The distribution installed there will be called the "installation". The original distribution running on this computer will be called the "host", and the computer will be the "host machine". The computer that will be using the NFS share will be called the "remote machine". Additionally, the copy of the installation on the remote machine will be called the "remote root".
Before beginning this process, your remote machine should be able to start and operate normally from the NFS server. Depending on what kind of media you want to use as the remote root, you may also want to work on making it start properly with root mounted read-only (you can set the NFS share to be read only). Because I am writing this for the Soekris, running from a 256MB compact flash drive, I set this up to be "mostly" read-only, with some things read-write. This is due to the limited number of write cycles before a CF card will cease to operate properly.
As a side note, setting the NFS root up to run read-only can let you do interesting things like run several identical machines from the same NFS share by keeping them from interfering with each other.
Also as a side note, I should document what I did to make it work "mostly" read-only and how I captured "stateful" information between boots (like random-seed)...
The key to transferring the filesystem is to be careful in transferring /dev, /proc, and other special files (sockets, etc.). If you try to use cp without excluding these, you'll find yourself filling the harddrive with the data read from device nodes, or a copy of /proc/kcore. Thus, the easiest way to do this is from the host machine, using tar in the /nfs/root directory, then extracting that tarball into the remote machine's drive. Make sure that your filesystem will fit on whatever drive you're going to use.
Preparing the Filesystem to boot
Converting the system configuration to use the local drive instead of the host's NFS share is the next step in the process. From here on out, everything uses the remote system. Start by updating
/etc/fstab to have / point to the local partition rather than the NFS server. Next, update the
pxelinux.cfg/default file in the tftp server so that the kernel will use the local filesystem rather than NFS for the root. Now reboot the remote machine so that it starts up using the root installation.
Next, you will need to install a boot loader. For now, I am using lilo. On the Soekris, the compact flash drive is
/etc/lilo.conf I have set:
append="console=ttyS0,19200n81 ip=DHCP panic=10"
If you configure a static IP address in
/etc/network/interfaces then leave the
ip=DHCP out. You can also leave it out if you intend to use a user-space DHCP client like dhcpcd, pump, or dhcp-client. Run
/sbin/lilo to install the boot sector and configuration, then reboot again, this time booting from the local drive rather than the network.
This document was last updated 2005-02-13