Configuring NFS Share on Ubuntu

Configuring NFS is a simple but can be a frustrating experience esp. if you are trying to export an NFS root.

Here’s step by step instructions that helped me.

On the server where NFS is configured, path is /storage. Let’s call this server nas. This NAS runs Ubuntu.

Edit the /etc/exports file on the NAS. The IP is your network and subnet mask. The magic option is fsid=0 for NFS root. This allows the /storage to be available as nas:/

/storage	192.168.4.0/255.255.255.0(fsid=0,sync,rw,no_subtree_check)

On the client, you can then run the following command to list the export.

sudo nfs-ls nfs://nas/storage
drwxr-xr-x 2 0 0 6 storage
drwxrwxr-x 3 5555 5555 58 backup
drwxrwxr-x 3 5555 5555 50 misc
drwxrwxr-x 3 5555 5555 31 downloads
drwxrwxr-x 12 5555 5555 214 photos
drwxrwxr-x 222 5555 5555 12288 movies
drwxrwxr-x 62 5555 5555 8192 tv

However, to mount, you will need to execute the following command from the client.

sudo mount -t nfs4 nas:/ /storage

Then confirm by listing the contents of /storage

ll /storage
total 32K
drwxrwxr-x   6 max  family   81 Mar 13  2023 .
drwxr-xr-x  23 root root   4.0K Jan  7 16:40 ..
drwxrwxr-x   3 max  family   58 Dec 23 00:46 backup
drwxrwxr-x   3 max  family   31 Nov 13  2022 downloads
drwxrwxr-x   3 max  family   50 Oct 25  2020 misc
drwxrwxr-x 222 max  family  12K Mar 13  2023 movies
drwxrwxr-x  12 max  family  214 May 17  2022 photos
drwxr-xr-x   2 root root      6 Jan  7 00:24 storage
drwxrwxr-x  62 max  family 8.0K Nov 13  2022 tv

That was it. Hope this was helpful to you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.