Checking it Out
Now we need to set everything up cleanly. The NFS server expects to find the exports file in the top level /etc directory, so create a symbolic link to our new exports file in the /share/hdd/conf/etc directory :
# ln -s /share/hdd/conf/etc/exports /etc/exports
Next, we need nice startup scripts for all of our new daemons. On the NSLU2, copy the rc.samba script from the /etc/rc.d directory to the new rc.d directory and modify it twice: once to create an rc.portmap script and once to create an rc.nfsd script. The rc.nfsd script should start the rpc.mountd and the rpc.nfsd.
Finally, build one script to do it all. Create the symbolic link, execute the portmap script and execute the nfsd script in that order. This script will need to be run each time the box is booted. As of yet, I have no way to automatically run startup scripts when the box boots.
Now, run the do-it-all script and try it out. A ps -ax from the NSLU2 should show three new processes running - portmap, rpc.mountd, and rpc.nfsd. Error and status messages will show up in the file /var/log/messages.
From a client machine try to mount the NSLU2. On my Mandrake system I executed the following as root:
# mkdir /mnt/nslu2 # mount 192.168.1.70:/share/ /mnt/nslu2/
On my Mac OS X box, I use the "Connect to Server" option of the Finder with a server format of:
If you have any issues starting the daemons, or in mounting, check the /var/log/messages file on the NSLU2. Note that having NFS on the box does not affect SMB, they can coexist peacefully.
Now that we've shown we can build a fairly complex service for the box, the sky's the limit. A FTP server might be a good next step. Or maybe an embedded SSH server such as dropbear would be useful. Let me know how it goes!
NOTE: As I wrote this article, I started from scratch and re-executed all of my original steps in order to make sure I hadn't forgotten anything. As usual, my development box was short on disk space, so naturally I NFS mounted the disk from the NSLU2. I did all of my untarring, compilations, editing, etc. on my NFS mounted drive. It performed flawlessly!
Tip: If you want to skip all this stuff and just want a binary that you can load onto your NSLU2 (you'll still need to edit the etc/exports file), you can download the ~57 kB file from http://www.nyx.net/~jbuzbee/nslu2-nfs-0.1.tar.gz.