Examples of hard and soft installation in NFS

Using the NFS protocol, NFS clients can mount existing file systems on the NFS server, just like local file systems.

NFS mount can be used as soft mount Or hard mount. These installation options define how the NFS client should handle NFS server crashes or failures.

In this tutorial, we will see the difference between soft and hard installation in NFS.

1) Soft installation

Suppose you have mounted the NFS file system using the following command soft mount. When a program or application requests a file from the NFS file system, the NFS client daemon will attempt to retrieve data from the NFS server. However, if the NFS server does not receive any response (due to the NFS server crash or failure), the NFS client will report an error to the process requesting file access permissions on the client computer.

The advantage of this mechanism is that the response speed is fast, because it does not wait for the NFS server to respond. But the main disadvantage of this method is data corruption or data loss. Therefore, this option is not recommended in situations where data integrity is critical.

$ sudo mount -o rw,soft host.nf_server.com/share_name /mnt/nfs_data

2) Hard installation

If the NFS file system has been mounted using the following command hard mount, It will retry to contact the server repeatedly. After the server comes back online, the program will continue to be executed without interference from the server during the crash. We can use the mount option “intr”, which allows interrupting NFS requests when the server is down or inaccessible. Therefore, the recommended settings are used with the intr option.

$ sudo mount -o rw,hard,intr host.nf_server.com/share_name /mnt/nfs_data

On newer versions of Linux, intr This option has been hard-coded into the kernel (after kernel 2.6.25), so it has been disabled. Therefore, you must use kill -9 to stop the NFS process.

in conclusion

For critical applications that cannot withstand any data corruption, the recommended option is to use hard mount.

In this tutorial, we discussed the difference between soft and hard installation options on NFS installations.

Also read:

  • How to force unmount NFS mount directory
  • Find detailed NFS mount options in Linux