NFS File Sharing on Raspberry Pi

I wanted to be able to access my Raspberry Pi filesystem from another machine to take advantage of more processing power elsewhere. It’s been many years since I’ve used NFS, and while it was easy to add to the Pi, I ran into a couple of issues that took some time to work out.

The primary use I was trying was to be able to mount the filesystem from a Debian instance of Linux running on Windows Subsystem for Linux (WSL) on my Microsoft Surface Pro 9. This would allow me to run FFMPEG working on some video files utilizing the power of the modern Intel chip instead of waiting for the Pi ARM processor to process the files.

While I was able to get the filesystem mounted from a second Pi easily, the WSL instance was more complicated. I realized that the problem is that by default WSL instances use Network Address Translation (NAT) for network access. This required the “insecure” option on the NFS server setting because NAT was changing the ports it was using to port numbers above 1024.

sudo apt install nfs-kernel-server -y

Edit the /etc/exports file to export the directory I wanted and set who has access to it. I’m limiting to my local network IP addresses, and not specifying any security. Because of my lack of security, I’ll be removing all of this after I am finished with the processing. Note the insecure tag at the end of the options.

Use the command sudo exportfs -ra to force the NFS server to reload its configuration file.

Use the command showmount -e to display what filesystems have been exported.

On the client machine:

sudo apt install nfs-common -y
sudo mkdir /media/WimPi4
sudo mount WimPi4:/media/WimPi4 /media/WimPi4

Because I didn’t squash the permissions and have matching uid and gid numbers on the machines I’m working with I can now work on the filesystem as if it was local to my machine.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s