NSLU2-Linux
view · edit · print · history

For OpenSlug 2.7, on first Initialization

After installing the firmware, and running turnup init to set up the network:

  1. Ensure you have an NFS server running with an empty directory exported with the options rw,no_root_squash.
  2. as described in turnup help, run turnup nfs -i <hostname>:<export_name>.
  3. shutdown -r now. It should come up in the new nfs area.

Check that you are running from the NFS export by creating a file on the slug, and checking the exported directory on the exported machine.

Note that the NFS root will not be used if there is a file .recover in the exported directory (see /boot/nfs). OpenSlug may create this file in error conditions, or you may wish to put it there to force a boot into flash.

For the Unslung-4.x family of firmware. To transfer the system to an NFS drive

To prepare for this you will need to have setup a few things.

  1. a NFS Server and exported directory for the rootfs to be stored.
  2. Using the web interface; fully configured network settings including gateway.

Then, you will need to copy the jffs2 rootfs to the new NFS rootfs. If your NFS Server is 11.22.33.44; the steps are similar to this on the nslu2.

 mount -o nolock 11.22.33.44:/home/slugroot /mnt/tmpmnt
 (cd / ; find . -print0 -mount | cpio -p -0 -d -m -u /mnt/tmpmnt)
 cd /mnt/tmpmnt
 rmdir dev
 rmdir var
 mv dev.state dev
 mv var.state var

Then you'll need to tell switchbox that you wish to use the nfsroot option.

 echo "nfsrootloc=11.22.33.44:/home/slugroot" > /.nfsroot
 echo "nfsrootopts=nolock" >> /.nfsroot

Or

 echo "11.22.33.44:/home/slugroot /mnt nfs nolock 0 0" >> /etc/fstab
 touch /.nfsroot

Other nfs options might be desireable, but this is the bare minimum required to make it work.

My fstab looks like this:

 192.168.0.63:/home/link2 /mnt nfs rsize=4096,wsize=4096,intr,nolock,noatime,hard,nfsvers=2 0 0

For the Unslung-6.8 beta firmware:

The linuxrc shipped with Unslung-6.8 beta does not support root file systems on nfs. So first you need to install a new linuxrc. Connect to the NSLU2 and execute the following commands:

 cd /
 wget http://www.openembedded.org/repo/org.openembedded.oz354x/packages/nslu2-binary-only/unslung-rootfs/linuxrc

Then you need to tell switchbox about the nfs root file system. Assuming that your nfs server is 11.22.33.44 and you exported /home/slugroot, the following commands will do it:

 echo "nfsrootloc=11.22.33.44:/home/slugroot" > /.nfsroot
 echo 'nfsrootopts="-o nolock"' >> /.nfsroot

Watch out for the quotes in the last command! It's different from the command used in version 4.x!

Now it's time to copy the root file system to the nfs mount:

 mount -o nolock 11.22.33.44:/home/slugroot /mnt/tmpmnt
 (cd / ; find . -print0 -mount | cpio -p -0 -d -m -u /mnt/tmpmnt)
 cd /mnt/tmpmnt
 rmdir dev
 rmdir var
 mv dev.state dev
 mv var.state var
 cd usr/bin
 rm ipkg
 ln -s ipkg-cl ipkg
 cd ../../etc
 rm motd
 ln -s motd-un motd

If you're getting errors while copying /dev.state to the nfs mount, you're probably using root_squash on your linux nfs server (or -maproot on FreeBSDs nfs server).

view · edit · print · history · Last edited by fcarolo.
Based on work by greg, hepp, hs, JimmyFergus, tman, and gerald_clark.
Originally by dyoung.
Page last modified on November 19, 2007, at 04:37 PM