Last Updated: 5/5/2023
In this segment we are going to talk about NFS. How to deploy and configure it.
We are going to use apt to install NFS server.
root@node5:/home/ubuntu# apt install nfs-common Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: keyutils libnfsidmap1 rpcbind Suggested packages: watchdog The following NEW packages will be installed: keyutils libnfsidmap1 nfs-common rpcbind 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 381 kB of archives. After this operation, 1,447 kB of additional disk space will be used. Do you want to continue? [Y/n]</code>
root@node5:/home/ubuntu# apt install nfs-kernel-server
In this example I have a directory (/mnt/lviso) which I want to share out to a entire network.
Edit the file /etc/exports The exports directory provides the instructions which describe which parts of the system we are gong to export and to which network locations.
/mnt/lviso 192.168.160.0/24(rw,sync,no_subtree_check) /mnt/lvnfs 192.168.160.0/24(rw,sync,no_subtree_check)
The following command instructs the NFS subsystem to rescan the “exports” and update accordingly.
$ sudo exportfs -a
Now it’s time to restart the NFS service. If this wasn’t already started.
$ sudo systemctl restart nfs-kernel-server
Manually mounting a NFS filesystem
On a remote client (of 192.168.160.0/24 fame) perform something like the following.
$ sudo mount -t nfs 172.16.104.251:/lvnfs /mnt