NFS-Root Mini-Howto: Setup on the server

prev-5384321 next-7362143 toc-8843083

RARP support in the kernel of the server will probably be a good idea. You must have it if you will boot without kernel parameters. On the other hand it doesn’t help you, if the client isn’t on the same subnet than the server.

The kernel for the workstation needs the following as a minimum set compiled in:

  • NFS-filesystem compiled in. (It doesn’t need to have ext2-support compiled in, a module suffices.)
  • « Root on NFS » must be enabled.
  • The Ethernet driver for the network card of the workstation must be compiled in.
  • Depending upon your needs you may have to include RARP or BOOTBP support for NFS-Root. (By this I mean the questions that are asked after the NFS question in make config.)

If the workstation will be booted without kernel parameters, you need also to set the root device to 0:255. Do this by creating a dummy device file with mknod /dev/nfsroot b 0 255. After having created such a device file, you can set root device of the kernel image with rdev /dev/nfsroot.

3.2 Creation of the root filesystem

Copying the filesystem

Warning: while these instruction might work for you, they are by no means sensefull in a production enviroment. For a better way to setup a root filesystem for the clients, see the NFS-Root-Client mini howto by Ofer Maor .

After having decided where to place the root tree, create it with (e.g.) mkdir -p and tar cClf / - | tar xpCf -.

If you boot your kernel without LILO, then the rootdir has to be /tftpboot/. If you don’t like it, you can change it in the top Makefile in the kernel sources, look for a line like: NFS_ROOT = -DNFS_ROOT="\"/tftpboot/%s\"" If you change this, you have to recompile the kernel.

READ  3.2.2 Logging in

Changes to the root filesystem

Now trim the unneeded files, and check the /etc/rc.d scripts. Some important points:

  • One important thing is eth0 setup. The workstation comes up with a, at least partially, setup eth0. Setting up the IP-address of the workstation to the the IP-Address of the server is not considered a clever thing to do. (As it happened to the author on one of his early attempts.)
  • Another point is the /etc/fstab of the workstation. It should be setup for nfs filesystems.
  • WARNING: Don’t confuse the server root filesystem and the workstation root filesystem. (I’ve already patched up a rc.inet1 on the server, and wondered why the workstation still didn’t work.)

Exporting the filesystem

Export the root dir to the work station. See exports(5). You most likely will have to restart the nfsd/mountd after this change. Under RedHat this can easily be done by typing /etc/rc.d/init.d/nfs stop ; /etc/rc.d/init.d/nfs start .

RARP setup

Setup the RARP somewhere on the net. If you boot without a nfsroot parameter, the RARP server has to be the NFS server. Usually this will be the NFS server. To do this, you will need to run a kernel with RARP support.

To do this, execute (and install it somewhere in /etc/rc.d of the server!):

/sbin/rarp -s

where

ip-addr

is the IP address of the workstation, and

hardware-addr

is the Ethernet address of the network card of the workstation.

example: /sbin/rarp -s 131.131.90.200 00:00:c0:47:10:12

You can also use a symbolic name instead of the IP-address, as long the server is able to find out the IP-address. (/etc/hosts or DNS lookups)

READ  The Linux Gazette 45: The Answer Guy

BOOTP setup

For BOOTP setup you need to edit /etc/bootptab. Please consult the bootpd(8) and bootptab(5) man pages.

Finding out hardware addresses

I don’t know the hardware address! How can I find it out?

  • Boot the kernel disk you made, and watch for the line where the network card is recognized. It usually contains 6 hex bytes, that should be the address of the card.
  • Boot the workstation with some OS with TCP/IP networking enabled. Then ping the workstation from the server. Look in the ARP-cache by executing: /sbin/arp -a

prev-5384321 next-7362143 toc-8843083