Meta

Adding a NFS share to Ubuntu

Submitted by admin, on January 16th, 2012

The NFS (Network File System) file system allows client machines to access files from another computer/server over a network connection. It was originally developed in 1984, and is still in wide use today. It is typically used with Unix/Linux systems, however many other operating systems contain support for NFS, whether that be inbuilt into the OS, or via 3rd party applications.

NFS is a great way to share out a bunch of .iso image files so that an ESX/vSphere server can access the files remotely.

The details below outline how to install a NFS server, and configure it for a simple share. The example was done on Ubuntu, so the installation and configuration procedure may differ slightly if using a different OS/distribution.

Install the packages required to set up a NFS server (if it has already been installed, skip this step).

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

Modify the /etc/exports file to set up the folder you want to share out via NFS.

sudo nano /etc/exports

You will need to add a line to the bottom of the exports file in the format below

/path/to/share ipaddress/subnetmask(options)

So for example, if you wanted to share out /mnt/storage/ISO for your LAN subnet of 192.168.0.0/255.255.2550, and make it read only, you would add the following line:

/mnt/storage/ISO 192.168.0.0/255.255.255.0(ro,no_subtree_check)

Update the NFS server with any changes to the exports file.

sudo exportfs -ra

Make sure you run this command whenever changes to /etc/exports has been made.

If you would like further information on what settings are available to use in the /etc/exports file, please view the exports man page by running:

man exports

You should now be able to access this remote share from another machine on the network. Also make sure that no firewalls are blocking the connection to the NFS server.