Creating mount points and mounting directories on client machine
In order to make the remote shares available on the client, you’ll need to mount the shared directories from the NFS server to empty directories on the client machine. Open a terminal on the client machine and create the directory for your mount:
sudo mkdir -p /new_client_directory
Note: If there are files and directories in your mount point, they will become hidden as soon as you mount the NFS share. To avoid the loss of important files, be sure that your mount directory is empty before you mount the NFS share.
Now you can mount the NFS share using the IP address of your NFS server:
sudo mount nfs_server_ip:/var/share /new_client_directory
This command will mount the shared directory /var/share from the NFS server onto the client machine at the mount point /new_client_directory.
You should now be able to access the shared directory on the client machine as if it were a local directory. You can confirm that they mounted successfully with the following command:
df -h
Filesystem Size Used Avail Use%
[...]
nfs_server_ip:/var/share 12.5G 2.95G 9.55G 24% /new_client_directory
sudo mount server:/home/user/shared /mnt/shared
Mounting the remote NFS directory at boot
You can mount the remote NFS shares automatically at boot by adding the mount command to /etc/fstab file on the client machine. Open the file with your text editor:
sudo nano /etc/fstab
At the bottom of the file, add a line for each of your shares. For example:
. . .
nfs_server_ip:/var/share /new_client_directory nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
You can find more information about the mount options in the NFS man page by running the following command:
man nfs
The client will now automatically mount the remote NFS shares at boot.
Unmounting NFS Remote Share
You can unmount an NFS shared directory from the client machine by moving out of the directory mount point and then using the umount commant:
cd ..
sudo umount /new_client_directory
Note that the command is named umount not unmount.
If you also want to prevent the NFS shared directory from being remounted on the next reboot, edit /etc/fstab and either delete the line or comment it out by placing a # character at the beginning of the line.
You can also prevent fstab from auto-mounting by removing the auto option, which will allow you to still mount it manually whenever you want.


Leave a Reply