NFS on RaspberryPi

articles/raspberryPi/PiLogo.png

Using image 2016-03-18-raspbian-jessie-lite.zip from https://www.raspberrypi.org/downloads/raspbian/

Installing NFS

$ sudo aptitude install nfs-kernel-server rpcbind

Configure NFS

Open /etc/exports, add line by example below. It should be client's IP address, the one how will mount the nfs.

/home/pi		192.168.1.101(rw,sync,no_root_squash,no_subtree_check,anonuid=1000,anongid=1000)

Exportfs - maintain table of exported NFS file systems. Option '-a' means - export or unexport all directories

$ exportfs -a
$ sudo service rpcbind restart
$ sudo service nfs-kernel-server restart

Mounting NFS

If clean's IP adress is 192.168.1.101 and raspberry pi (server) IP is 192.168.1.100

$ sudo mount 192.168.1.100:/home/pi /mnt

Benchmarking

NFS averages 6.4MB/s file tarsfer
SSHFS averages 3.0MB/s file tarsfer
* when rootfs is on USB HDD

Troubleshooting

$ sudo service nfs-kernel-server status

In case "raspberrypi nfs-kernel-server[312]: Not starting: portmapper is not running ... (warning).", it means rpcbind is not running.

$ sudo service rpcbind status

Id mapping for NFS

Example:

if client user

$ id
uid=1001(rolas)

and sever user

$ id
uid=1000(pi)
You won't be able to mount NFS! Set "NO" on the client and server:

$ sudo cat /sys/module/nfs/parameters/nfs4_disable_idmapping
$ sudo echo "N" > /sys/module/nfs/parameters/nfs4_disable_idmapping

Resource

how-to-set-up-an-nfs-mount-on-ubuntu-12-04
http://serverfault.com/questions/514118/mapping-uid-and-gid-of-local-user-to-the-mounted-nfs-share#632315