mount.nfs: Stale file handle error - cannot umount

A mount -t nfs fails with Stale file handle if the server has some stale exports entries for that client.

Example scenario: this might happen when the server reboots without the client umounting the nfs volumes first. When the server is back and the client then umounts and tries to mount the nfs volume the server might respond with:

mount.nfs: Stale file handle

You can check for this via looking at /proc/fs/nfs/exports or /proc/fs/nfsd/exports. If there is entry for the client it might be a stale one.

You can fix this via explicitly un-exporting and re-exporting the relevant exports on the server. For example to do this with all exports:

# exportfs -ua
# cat /proc/fs/nfs/exports
# exportfs -a

After this the client's mount -t nfs ... should succeed.

Note that mount yielding ESTALE is quite different from some other system call (like open/readdir/unlink/chdir ...) returning ESTALE. It's export being stale vs. a file handle being stale. A stale file handle easily happens with NFS (e.g. a client has a file handle but the file got deleted on the server).

The error, ESTALE, was originally introduced to handle the situation where a file handle, which NFS uses to uniquely identify a file on the server, no longer refers to a valid file on the server. This can happen when the file is removed on the server, either by an application on the server, some other client accessing the server, or sometimes even by another mounted file system from the same client. The NFS server also returns this error when the file resides upon a file system which is no longer exported. Additionally, some NFS servers even change the file handle when a file is renamed, although this practice is discouraged.

This error occurs even if a file or directory, with the same name, is recreated on the server without the client being aware of it. The file handle refers to a specific instance of a file and deleting the file and then recreating it creates a new instance of the file.

The error, ESTALE, is usually seen when cached directory information is used to convert a pathname to a dentry/inode pair. The information is discovered to be out of date or stale when a subsequent operation is sent to the NFS server. This can easily happen in system calls such as stat(2) when the pathname is converted a dentry/inode pair using cached information, but then a subsequent GETATTR call to the server discovers that the file handle is no longer valid.

This error can also occur when a change is made on the server in between looking up different components of the pathname to be looked up or between a successful lookup and a subsequent operation.

Original link about ESTALE: ESTALE LWN .

I suggest to you check files and directories on NFS server or say to admin of NFS server to do this.

Maybe some old pagecache, inode, dentry cache entries are exists on NFS server. Please clean it:

# To free pagecache
echo 1 > /proc/sys/vm/drop_caches

# To free dentries and inodes
echo 2 > /proc/sys/vm/drop_caches

# To free pagecache, dentries and inodes
echo 3 > /proc/sys/vm/drop_caches