The question was: “What is the difference between hard and soft mounts when using NFS?”

I will copy and paste a reply I found today with the notice that this is not my own answer, but I thought it thorough and informative enough to post here…

From an hp.com forum post:

Honored Contributor Matti_Kurkela
Honored Contributor
Matti_Kurkela
Posts: 6,009
Registered:
‎12-02-2001
Message 2 of 2
(1,797 Views)
Re: what is the difference betweeen NFS hard mount and softmount
Post Options
‎03-07-2012 03:21 PM

You’re assuming that a NFS filesystem will be unmounted if the NFS server is not reachable. This is not true.

What actually happens is a bit more complicated.

To avoid wasting network bandwidth, the NFS client will not continuously poll the NFS server to make sure it is still reachable. So the NFS client won’t always know that the server has become unreachable until it tries to access a file on the NFS server.

Most of the filesystem I/O goes through the buffer cache (memory-mapped files are always cached, other methods may have an option to avoid caching). Normally, when a program writes something to a file, the OS will make some checks, and if there is nothing to stop the operation from succeeding, the data to be written is accepted into the cache and the program is told that the write is successful. The OS will do the actual write a bit later, in the hope that it can gather multiple small write operations and write them all in one big operation, because it will be more efficient. Normally this works well.

But if the NFS server becomes inaccessible between the data hitting the cache and the actual write operation, the OS has a big problem. As far as the program is concerned, the write operation was successfully done and firmly in the past; the OS already told it so. There is no way for the OS to go back on its word and tell the program that the write operation failed after all.

At this point, the OS has two choices:
It can hold the program in a frozen state while it tries again and again to reach the NFS server and complete the write operation. This is exactly what the hard mount does. At this point, the kernel usually outputs a message for all logged-in users: “NFS server not responding, still trying” in order to alert the users that there is a problem,
Or the OS can keep trying for a while, then give up and throw away the data, and tell the program that accessing the NFS filesystem is no longer possible when it makes the next NFS write operation. This is what the soft mount does. (The program will know that operation #2 failed, but it will have no clue that operation #1 failed too.)
Whether the mount was soft or hard, it should automatically recover as soon as the NFS server is reachable again. (However, if the NFS server has rebooted while it was unreachable, any file locks that may have been established on the NFS filesystem before must be recovered with a special procedure or they will be lost, and that can be yet another can of worms…)

After this bit of background, the answers to your actual questions:

1.) No, you don’t need to re-mount soft NFS mounts after a NFS server becomes unreachable and then returns.

2.) As far as I’ve undrstood, you can use soft mounts safely only if:
you don’t care that you might lose some data if the NFS server becomes unreachable, or
your programs “know” that they are working with a soft-mounted NFS filesystem and are designed to take special steps to guard against data loss.
So, in some very limited circumstances, a soft NFS mount might be useful, but in general, soft NFS mounts are a bad idea. Don’t use them unless you really know what you’re doing.
MK