< All posts

Dec. 30, 2019, 9:14 a.m.

Trying NFS Server on my RPi

I have a problem with my Samba Server (SMB), it occurs when a network connection disconnects and reconnects. The entire CIFS mount just stops responding until I reboot my client machine. It appears that I am not the only one experiencing this issue. I have decided to try using the NFS Server and compare it to SMB.

First, we need to install the NFS Server package: sudo apt-get install nfs-kernel-server

And now we configure the NFS mounts from our server: sudo nano /etc/exports

/home/pi/       10.10.10.0/24(ro,sync,no_subtree_check)

/home/pi/ is the directory that we want to share.

10.10.10.0/24 is our whitelist IP address and subnet, this means that the entire 10.10.10.0 ~ 10.10.10.254 clients will be allowed to access our pi directory.

ro means read only, this will not allow us to write to the pi folder.

This will let us read the pi directory without any write permission.

After making changes to /etc/export we need to restart the nfs server: sudo /etc/init.d/nfs-kernel-server restart

To our client machine, we nee to install the nfs-common package in order for us to connect to our server:
sudo apt-get install nfs-common

For us to automatically mount our NFS share we need to edit the /etc/fstab file and issue the sudo mount -a command.

10.10.10.1:/home/pi/  /media/user/pi  nfs ro,hard,intr 0 0

10.10.10.1 is the server’s IP address

/home/pi/ is the share path.

/media/user/pi is our local mount path, make sure that this directory and path exists.

I tested the disconnection and reconnection of network and the mounted NFS directory does cause a hung but not indefinitely, it recovers after a network connection is restored.

This is still WIP, I may update this post in the near future.

Merry X-mas and Happy New Year!

Further read:

https://askubuntu.com/questions/7117/which-to-use-nfs-or-samba

https://pimylifeup.com/raspberry-pi-nfs/

https://www.htpcguides.com/configure-nfs-server-and-nfs-client-raspberry-pi/