RaspberryPI as nfs share server

Server side

1. Install nfs server

sudo apt-get install nfs-kernel-server -y

2. Update share configuration

Append to file /etc/exports

/nfsshare *(rw,all_squash,insecure,async,no_subtree_check,anonuid=33,anongid=33)

Following configuration applied:

  • /nfsshare: the folder we share in network
  • *: limit the ip range, eg: to allow all IP’s from 192.168.0.0 to 192.168.0.256, we can replace the asterisk with 192.168.0.0/24.
  • rw: allows both read and write requests on the NFS volume
  • all_squash: map all uids and gids to the anonymous user
  • insecure: allows clients with an NFS implementation that doesn’t use a reserved NFS port
  • async: allows the NFS server to break the NFS protocol to improve performance at the cost of data potentially becoming corrupted if the server crashes
  • no_subtree_check: disables subtree checking, while it comes at a cost to security it can improve the reliability of the NFS server
  • anonuid=33,anongid=33 userId and groupId for a user that is connecting anonymously

3. Apply new exportfs config:

sudo exportfs -ra

That’s all for server-side!


Client side

Ubuntu

1. Install client:

sudo apt install nfs-common

2. Test mount point

# create folder for mount point
sudo mkdir /pi-server-02
sudo mount 192.168.1.196:/nfsshare /pi-server-02

3. Permanent mount

If it’s works in the previous step, you can create an /etc/fstab entry:

192.168.1.196:/nfsshare /pi-server-02	nfs 	defaults 0 0

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.