Re: Mounting root via NFS

Avery Pennarun (apenwarr@foxnet.net)
Thu, 7 Mar 1996 22:25:57 -0500 (EST)


Someone replied already and mentioned a Mini-HOWTO at:
ftp://ftp.ag.or.at/people/andreas/NFS-Root-Mini-Howto

However, I have some additional comments below, particularly re: the RARP
server and kernel options.

On Thu, 29 Feb 1996, Steffen Boerm wrote:

> it looks as if there'll soon be a temporarily harddisk-less pc
> in our NE2000-based TCP/IP-LAN.
>
> So I'd like to boot this machine from a disk and mount root
> via NFS. How do I do it? My first try was to simply enable
> "root via NFS" while making config und using zdisk to create
> a boot disk. It didn't work.
>
> Can it be done? And, if so, how?

I did this on my ARCnet network. Linux 1.3.69+ has a redone NFS client
which is super-cool (though a bit buggy) and great for this situation. It
is literally more than twice as fast as 1.3.68, and I can now boot and get a
4MB RAM machine into minimalist X-Windows in 20 seconds flat after loading
the floppy (on ARCnet - ethernet would be faster). It used to take 40
seconds or so.

I couldn't find any documentation on nfs-root myself, and it was frustrating
having to look through the kernel code just to use such a simple feature. I
would like to encourage the author to add a file about this to the
linux/Documentation/networking directory, or at least point to the
Mini-HOWTO somewhere.

Here's what I did. Those who know better, please correct anything stupid
that I say:

1) Turn on the "root filesystem via NFS" option and recompile the kernel.

2) Place the kernel file on a floppy ("make zdisk" should be fine).

3) Set the root filesystem on the kernel to device 0:0 - the quickest way I
found to do this was to create a file with mknod with major/minor numbers
0/0 and use rdev to set it, like this:
mknod /dev/nfsroot b 0 0
rdev /dev/fd0 /dev/nfsroot

4) Boot from the disk. If all goes well, the card will be initialized and
a RARP request will be sent out. Your NFS server should have the RARP
server enabled, and serve an NFS directory /tftpboot/IP.AD.DR.ESS (by
default, edit linux/Makefile to change this). This directory will be
used as the root fs.

You can also use the nfsroot and nfsaddrs kernel-commandline options if you
use lilo or some other bootloader to start up. With these, you can set the
various IP addresses and NFS directory at load-time, and you don't need a
RARP server at all. However, since bootloaders can add from a few to many
seconds to the floppy boot process, I find this less convenient. Plus, it
means making a different bootfloppy for each station.

I actually tried these options out (not exactly user-friendly, BTW) when
RARP didn't work for me, until I realized I had to disable my arc0e/arc0s
virtual ARCnet devices. Real people shouldn't have that problem, but I
believe it is due to a bug in nfsroot. It should keep careful track of the
device it uses, but for some reason it ifconfig's arc0 up - creating
arc0e/arc0s - and then tries to RARP on arc0s. I haven't looked into this
further, as it was much easier for me (the author of the ARCnet driver) to
change the arcnet.c code instead. (It was simply additional encouragement to
make the arc0e and arc0s devices optional, which I had meant to do anyway to
save memory.)

Other trivia: I've heard someone is working on bootp support. This would
be great, since RARP was always a hack and much, much less flexible than
bootp. In particular, it would be nice if the _server_ could specify the
root NFS directory, and if the bootp server could be different from the NFS
server.

Good luck with it!

Avery