view · edit · print · history

How to setup NFS-Kernel-Server on SlugOS/LE (former DebianSlug)



You'll need a working install of SlugOS/LE! This means you can ssh into your box, su to root and install packages via apt-get.

Kernel Modules

If you built your own SlugOS/LE image using the MasterMakefile, you'll end up with a lot of kernel-module-*.ipk files in ~/slug/debianslug/tmp/deploy/ipk/
You'll need these (at least some of them) to install the NFS server. To make a long story short: You need these modules:

  • kernel-module-nfsd
  • kernel-module-sunrpc
  • kernel-module-lockd
  • kernel-module-exportfs (see below for exportfs specific solution)

If you don't have the kernel-module-*.ipk-files, it's best to rebuilt the DebianSlug image, and upgrade your flash as per description at BootstrapLE#upgrade

(if you run slugoOS debianslug, just wget the from http://ipkg.nslu2-linux.org/feeds/debianslug/ )

Put the ipk-files on the Slug (sftp/samba/ftp). I assume you put them in /home/slug/modules. Be root:

cd /home/slug/modules
dpkg --force-architecture -i kernel-module-nfsd* kernel-module-sunrpc* kernel-module-lockd* kernel-module-exportfs*
depmod -a

This will install the required modules into /lib/modules/`uname -r` and rebuild the module dependencies:


Still beeing root:

apt-get update
apt-get upgrade
apt-get install nfs-kernel-server


Sample Config

Edit /etc/exports with your favourite text editor (vi/joe/whatever)

# IMPORTANT: Make sure there's no blank between the network/host address and the "("
# Example 1: Exporting /home/dbox/pictures to the entire local 
# network / for reading and writing

# Example 2: Exporting /home/dbox/record to host for reading and writing

# Example 3: Exporting /home/dbox/mp3 to the entire internet read only
# Don't worry! As long as you didn't set up port forwarding on your router from your 
# public (internet) ip to the slug , or the slug is set up to have a public ip or
# it's on the DMZ, only the clients on the local network can access the slug
# to be on the safe side, check if you can access ports 111 and 2049 on the slug from the internet
# If you cannot, you're safe!
/home/dbox/mp3 *(ro)

Start the nfs-server!
/etc/init.d/nfs-kernel-server start


If you're running into problems, this might be handy:

  • exportfs (shows the directories which are exported and the client that are allowed to access them)
  • tail -f /var/log/syslog (this shows the latest syslog messages (the nfs-server sends is logging to the syslog, so you can check it for errors))
  • check if all kernel-modules are loaded on the Slug (server):
Module                  Size  Used by
nfsd                  186128  13
exportfs                2752  1 nfsd
lockd                  45812  2 nfsd
sunrpc                104576  9 nfsd,lockd

and on the client

Module                  Size  Used by
nfs                   219720  1
lockd                  62216  1 nfs
sunrpc                150332  3 nfs,lockd

Fixing exportfs

My own installation was based on an older version of the DebianSlug instructions, and failed to install the module exportfs.ko. My solution was to bash my head against the internet, and with the help of some smart'uns, I found this to work.

My system reports the following from uname:

slug:/etc# uname -a
Linux slug 2.6.16 #1 PREEMPT Thu Jun 8 23:38:13 PDT 2006 armv5tel GNU/Linux

And since I seemed to be lacking any exportfs-specific hooks for nfsd to latch to, I had to find a kernel-specific version of exportfs that matched. A bit of searching returned this link.

Too bad it's in .ipk format, and not a .deb that I could "apt-get". BUT I recalled seeing something about loading kernel modules manually, so I followed the directions (from the old, obsolete page I used to load up my NSLU2 with Linux) here, under "Manual Install".

Here's what I did:

1) Get the kernel module suitable for your kernel (as located mentioned in the previous message, being here

slug:~# wget http://ipkg.nslu2-linux.org/feeds/slugos-lag/cross/stable/kernel-module-exportfs_2.6.16-r6.6_ixp4xxle.ipk
Connecting to ipkg-us-dyoung.nslu2-linux.org||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4,510 (4.4K) [text/plain]

100%[====================================>] 4,510         --.--K/s

2) Unpack it into the kernel directories

slug:~# ar -x kernel-module-exportfs_2.6.16-r6.6_ixp4xxle.ipk
slug:~# tar xvfz data.tar.gz -C /

3) Kick it in the butt to get it loaded

slug:~# depmod -a

4) Load up the nfs server

slug:~# /etc/init.d/nfs-kernel-server start
Starting NFS kernel daemon: nfsd mountd.

5) Confirm it's running correctly

slug:~# cat /var/log/messages
Dec 13 22:11:39 slug kernel: Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Dec 13 22:11:40 slug kernel: NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
Dec 13 22:11:40 slug kernel: NFSD: starting 90-second grace period

6) Make sure you have a share config'd in the /etc/exports file, and get to work!

view · edit · print · history · Last edited by Dave Hrynkiw.
Based on work by Dave Hrynkiw, fcarolo, PatrickSchneider, Antikristian, and Patrick Schneider.
Originally by Patrick Schneider.
Page last modified on December 13, 2006, at 09:39 PM