NFS Stale File Handle error and solution

Symptoms

When you try any read/write operation [For example ls] to certain NFS mount you get "Stale File Handle" error, that mainly occur due to a poor-application that is not written specifically for NFS and sometimes after a storage sudden failures

According to  Managing NFS and NIS, 2nd Edition book:
A filehandle becomes stale whenever the file or directory referenced by the handle is removed by another host, while your client still holds an active reference to the object. A typical example occurs when the current directory of a process, running on your client, is removed on the server (either by a process running on the server or on another client).

Purpose

How to get out of the "Stale file Handle" NFS issue

Resolution

The below points are possible solution for the issue 

1- Try flushing the NFS cache

       exportfs -a

2- Restart NFS daemon

service nfs restart

3- Use lazy umount on all of your clients

umount  -l  /The-Share


UMOUNT(8) :

-l     Lazy  unmount.  Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy any-

              more.  (Requires kernel 2.4.11 or later.)


4- Restart all the clients [worst case scenario]

That is the last resort, and 100% it will release all of file handles from al of the clients




Update History


12-28-2018Created