NFS Client Configuration For My Dummy Colleagues
NFS (Network File System) is the most popular file sharing for Linux systems to access files from remote client. NFS can be very troublesome because of misconfiguration. The most challenges with NFS is network interruption and connection problem between NFS client and NFS server.
You can reduce NFS problems by using right configurations and parameters during mounting to a mountpoint.
Mounting Options in “fstab”
You can specify a number of options that you want to set on the NFS mount. We will go through the important mount options which you may consider while mounting a NFS share.
Many of default value of options are recommended, so any changes will be affected NFS reliability.
You can see the options on this link: nfs(5)
Using Autofs to Mount NFS
The main problem about NFS mount-points is hang on network disruption. Most cases needs to unmount and mount manually.
Autofs uses the automount daemon to manage your mount points by only mounting them dynamically when they are accessed.
Autofs service reads two files Master map file ( /etc/auto.master ) and a map file like /etc/auto.misc or /etc/auto.xxxx.
In “/etc/auto.master” file we have three different fields :
/<Mount-Point> <Map-file> <Timeout-Value>
In map file (/etc/auto.misc or /etc/auto.xxxx) also we have three different fields:
<Mount-Point> <Mount-Options> <Location_of_File System>
First, Edit Master Map File
If you want to mount NFS on a mount-point for example /sampleNFS, so you need to add a line like the below to /etc/auto.master
vi /etc/auto.master
/sampleNFS /etc/auto.sampleNFS --timeout=180
“timeout”, it means that mount-point will be unmounted after 180 seconds, if there was no file operation.
Create Map File The Mount-Point
Next step is creating map file for auto.sampleNFS:
vi /etc/auto.sampleNFS
NFS_Sample -fstype=nfs,rw,soft,intr x.x.x.x:/NFS
Note: The used options are for the sample and you should use right options according to your requirements.
After that, file should be saved and “autofs” service should restart.
Then, the mount-point will be activated during first file operation such as “cd” command.
The mount-point will active for 180 seconds and after that, it will be unmounted automatically.
Conclusion
NFS may be unstable if you didn’t use correct configurations but other distributed file systems also have same situation during a network disruption. Recovering the situation is depending to your configuration as well.
Further Reading
Parallel NFS (pNFS) – Part 1 (Introduction)
Change Administrator’s Password for All HPE C7000 Device Bays