NFS

Installing

Install nfs-common, and, if you want an NFS-server also nfs-kernel-server.

Exporting directories

Edit /etc/exports. See the manual exports(5) for details. Example:
/home           10.11.12.0/24(rw,sync,no_subtree_check)
/somehostdir    192.168.1.23/32(rw)
/some/other/dir *.example.com(rw)
/export         *(ro)
Then run this command:
exportfs -a

Mounting

Here is an example of mounting the /home directory of somehost to an existing directory /mnt on the local machine.

mount -t nfs -o 'hard,intr' somehost:/home /mnt
The option hard will cause retries when network errors occur during read/write operations.

To show a list of what you have mounted, run the command:

nfsstat -m

Troubleshooting

  • Some hosts require the client to be in /etc/hosts.
  • Different versions of NFS exist. There is v4, v3 and v2. Sometimes fallbacks of the protocol won't work. Try specifying a protocol version, like this:
    mount -t nfs -o 'hard,intr,vers=3' somehost:/home /mnt
    
  • Try restarting the NFS-server.