Network filesystems


The Network Files System (NFS) allows to access files and directories over the network on Linux (Unix) computers. If there is a Windows computer samba is the alternative to nfs. The computer holding those data must have a nfs server and the computer requesting access to the data must have a nfs client.


There are different major versions and therefore incompatibilities. Having everywhere the same version obviously is a good idea.

To work with nfs, the nfs kernel features need to be enabled. The nfs-utils package needs to be installed.

For Gentoo Linux check also the nfs useflags and the nfs useflags indicating the nfs version.

Finally, check if your number assignments for user and group names are consistent between the computers. cat /etc/passwd and cat /etc/group

See also:

To get the client and the server emerge nfs-utils on all computers involved.

Nfs server

The configuration file that has to be edited on the server is /etc/exports to define what will be available on the network. See also man exports

<server directory> <client computer name>(rw)
<other server directory>

or as example

/home/lindegur/Urs black(rw,async,no_subtree_check)

Either the clients IP address or the name of the computer have to be added. An example to give read only access to the multimedia directory:



Avoid exporting symlinks

mounting As man 5 exports tells, wildcards in ip addresses might work just per accident, so avoid to use them use a netmask instead.

No space is allowed in front of the ( character.

To give all computer in a home net access us a netmask


or in the form counting the bits in the netmask having a 1


To start the server (and client) /etc/init.d/nfs start and consider to add it to the init scripts rc-update add nfs default

After editing and when the server is already running type exportfs -a

This is necessary to move the stuff to /var/lib/nfs/xtab.

Some commands to show if the system is happy:

rpcinfo -p to see if the daemons are running

showmount -e to see what the server exports

showmount -a to see who accesses the server

Or directly from the kernel cat /proc/fs/nfs/exports

nfs does not use inetd or xinetd, however it considers the two files /etc/hosts.allow and /etc/hosts.deny from xinetd for more details.

Nfs client

The data on those computers can simply be mounted as it would be a local disk drive:

mount -t nfs <remote computer>:/<remote directory></local mounting point>

An example:

mount -t nfs /mnt/media


mount -t nfs <computername>:/home/lindegur/media /mnt/media

When done do a umount</local mounting point>

It is also possible to have it mounted without typing a lot by using a line in /etc/fstab such as:

<remote computer>:/<remote dir> </local mounting point> nfs user,auto,exec 0 0

After that you can mount -a to get everything mounted that is defined in /etc/fstab . The option auto is quite important, when the server is running during boot of the client the clients mounts the network drives automatically. Otherwise they would have to be mounted manually. If the remote computer is not accessible then boot struggles with retraining to connect and finally after a long time out it continuous with its boot process.

The automounter autofs is a better option since it mounts the network drives just on demand when they are getting accessed.

If your nfs server is not always online you can set noauto in /etc/fstab so it will not cause delays on boot due to failures and retries to connect the unavailable nfs server.

<remote computer>:/<remote directory> </local mounting point> nfs   user,noauto,exec 0 0

If the server is up you simply can mount the drives manually by mount /mnt/<mountpoint>.

Instead using /etc/fstab autofs can be used that mounts the network drive on demand.

Nfs troubles

Since time is moving and the system evolves things can happen:

If you get IP6 errors when start the server then comment or uncomment IP6 stuff in /etc/netconfig.

If you get:

mount.nfs: an incorrect mount option was specified

and run nfs version 3 on a new system you might get in troubles since it wants to take version 4. You can fix that with modifying /etc/fstab to hold the nfsvers=3 parameter:

<remote computer>:<remote directory> <local mounting point> nfs   user,auto,exec,nfsvers=3 0 0

Linurs startpage