logo
vision scalability social networking revelation source

Network file system

abstract: Setting up NFS (Network File System) server and client for sharing files between real and virtual machines on a local network.

1 Network file system

This is most useful when you have a lot of real and virtual machines on your local network

1.1 Server

sudo apt update && sudo apt upgrade -qy
sudo apt install -qy nfs-kernel-server nfs-common.
sudo nano /etc/default/nfs-common

In the configuration file nfs-common change the paramter NEED_STATD to no and NEED_IDMAPD to yes. The NFSv4 required NEED_IDMAPD that will be used as the ID mapping daemon and provides functionality between the server and client.

NEED_STATD="no"
NEED_IDMAPD="yes"

Then to disable nfs3 sudo nano /etc/default/nfs-kernel-server

RPCNFSDOPTS="-N 2 -N 3"
RPCMOUNTDOPTS="--manage-gids -N 2 -N 3"

then to export the root of your nfs file system: sudo nano /etc/exports

/nfs     192.168.1.0/24(rw,async,fsid=0,crossmnt,no_subtree_check,no_root_squash)
sudo systemctl restart nfs-server
sudo showmount -e

1.2 client

sudo apt update && sudo apt upgrade -qy
sudo apt install -qy nfs-common
sudo mkdir «mydirectory»
sudo nano /etc/fstab
# <file system>       <mount point> <type> <options> <dump> <pass>
«mynfsserver».local:/ «mydirectory» nfs4   _netdev   0      0

Where the «funny brackets», as always, indicate mutas mutandis.

sudo systemctl daemon-reload
sudo mount -a
sudo df -h

Creative Commons License reaction.la gpg key 154588427F2709CD9D7146B01C99BB982002C39F
This work is licensed under the Creative Commons Attribution 4.0 International License.