Add NFS version 4 to the Raspian kernel
The current version of the Raspian distro (2012-08-16-wheezy-raspbian) does not have NFS version 4 enabled for RPC. To check if your kernel has RPC support for NFS version 4, run
Code: Select all
rpcinfo -pCode: Select all
CONFIG_NFSD=m
# CONFIG_NFSD_V3 is not set
# CONFIG_NFSD_V4 is not setCode: Select all
CONFIG_NFSD=y
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=ySetting the Pi up as a NFS server
On the Pi, execute the following in the terminal. (Anything after a # is a comment, and you don't have to type it in.)
Code: Select all
sudo su
apt-get install nfs-kernel-server
mkdir /export
mkdir /export/arbitrary_local_name_of_share # this name will be seen by clients accessing the share
mount --bind /path/to/folder/to/export /export/arbitrary_local_name_of_share
nano /etc/default/nfs-common
Change "NEED_IDMAPD=" to "NEED_IDMAPD=yes"
Change "NEED_GSSD=" to "NEED_GSSD=no"
nano /etc/exports # add the following line
/export 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async,crossmnt) # I had to use crossmnt otherwise I only saw empty directories from the client
/etc/init.d/nfs-kernel-server restartCode: Select all
exportfs: could not open /var/lib/nfs/.etab.lock for locking: errno 13 (Permission denied)
exportfs: can't lock /var/lib/nfs/etab for writing
exportfs: could not open /var/lib/nfs/.xtab.lock for locking: errno 13 (Permission denied)
exportfs: can't lock /var/lib/nfs/xtab for writing
. ok
[warn] Not starting NFS kernel daemon: no support in current kernel. ... (warning).Code: Select all
sudo service rpcbind startCode: Select all
sudo update-rc.d rpcbind enable && sudo update-rc.d nfs-common enableIf, after "/etc/init.d/nfs-kernel-server restart", you get the following error
Code: Select all
mountdrpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6Code: Select all
sudo modprobe ipv6Code: Select all
sudo mount --bind /path/to/folder/to/export /export/arbitrary_local_name_of_share
Code: Select all
sudo mkdir /mnt/pi # only required the first time
sudo mount -t nfs4 -o proto=tcp,port=2049 ip.address.of.pi:/ /mnt/piCode: Select all
sudo umount /mnt/pi