Note
- 22 Aug 2022: Client mount setting revised.
- 17 Aug 2022: Client mount setting revised.
Intro
NFS network file system enables sharing of directories on a Ubuntu server to another Ubuntu client computer.
Install on server computer
Install network file system:
$ sudo apt-get install nfs-kernel-server
Configure to specify the directory to be exported:
$ sudo gedit /etc/exports
Specify:
/<directory exported> <ip address of computer to export to> (rw, sync, no_root_squash)
where "rw" = read and write.
Start the server, required after any rebooting:
$ sudo systemctl start nfs-kernel-server or $ sudo service nfs-kernel-server start
Set up client computer
Install nfs-common on the client side:
$ sudo apt install nfs-common
Create a local directory:
$ sudo mkdir -p /media/<local directory>
Mount the remote directory temporarily:
$ sudo mount <ip address of NFS server>:/<directory exported from the NFS server> /media/<local directory>
but remounting required after every reboot.
To keep the mounting permanently unaffected by reboot, edit "fstab" file:
$ sudo gedit /etc/fstab
Add a line:
<ip address of NFS server>:/<directory exported from the NFS server> /media/<local directory> nfs auto,vers=4.0 0 0
(revised 22 Aug 2022, "vers=4.0" added)
(revised 17 Aug 2018, "defaults" changed to "auto")
Mount again all devices as defined in the "fstab" file after changes:
$ sudo mount -a
Check devices actually mounted (this would show more than those defined in "fstab"):
$ sudo mount -l