Slackware nfsroot

The performance is surprisingly good, and rivals that of a USB flash disk. It can't compare with a USB hard disk though, especially when doing things that make the system swap.

Here's what you do:

Setting up your server

Create the directory /srv/nfsroots (or wherever you want to put the rootfs)

Add the following line to /etc/exports:


192.168.1.X is my LAN.

Start the nfs daemon:

For Slackware:

chmod 755 /etc/rc.d/rc.nfsd

/etc/rc.d/rc.nfsd start

(Follow instructions for whichever distro you're using).

Setting up the rootfs

You can grab the Slackware rootfs from Sourceforge and it should work OK. In fact, you can probably follow most any Debian/Gentoo/Slackware instructions for the Bifferboard, they should work the same. Uncompress the files into /srv/nfsroots/slackware.

Compiling the kernel

I used Linux 3.3 rc1. You can use it completely un-patched for initial testing of nfsroot then try to add any patches you need for desired functionality. At a minimum you want the PIT tick rate patch so your clock doesn't become inaccurate. Use the configuration attached at the bottom of the page as a starting point, it's minimal and fits even on 1MB devices.

Copying the kernel modules

As explained elsewhere, you need to compile and copy any kernel modules , with something like:

make modules_install INSTALL_MOD_PATH=<rootfs location>

Put the generated directory structure in the rootfs, under /lib/modules.

Configuring Biffboot

The kernel configuration at the bottom of this page doesn't embed any command-line options! It leaves this all up to the bootloader. You need to use a Biffboot kernel command-line like this:

console=uart,io,0x3f8 root=/dev/nfs ip=dhcp nfsroot= ro

You can change the ip= part to set a static IP address if you prefer. Look in the kernel source under Documentation/filesystems/nfs/nfsroot.txt for a complete breakdown of all possible options.

Configuring Swap

It probably doesn't make sense to have a huge swap file when the network is going to limit the performance. On the server, create a swapfile, say 64M like this:

dd if=/dev/zero of=/srv/nfsroots/slackware/swapfile bs=1024 count=64k

Then format it for swap (again on the server):

mkswap /srv/nfsroots/slackware/swapfile

You associate a loopback device with the file:

losetup /dev/loop0 /swapfile

Then start using the loopback device for swap:

swapon /dev/loop0

You have to add a startup script somewhere to perform the losetup on every boot, /etc/rc.d/rc.S might be a good candidate.

That's all!