Stale NFS handle

From lxadm | Linux administration tips, tutorials, HOWTOs and articles
Jump to: navigation, search

Ever rebooted your NFS server, just to find out that your NFS clients can’t access it any more, with an error message “Stale NFS file handle”? If this happened to you and you have your NFS server’s exports on a LVM volume, this means that you didn’t read a fine exports manual:

This option forces the filesystem identification portion of the file handle and file attributes used on the wire to be num instead of a number derived from the major and minor number of the block device on which the filesystem is mounted. Any 32 bit number can be used, but it must be unique amongst all the exported filesystems.

This can be useful for NFS failover, to ensure that both servers of the failover pair use the same NFS file handles for the shared filesystem thus avoiding stale file handles after failover.

Some Linux filesystems are not mounted on a block device; exporting these via NFS requires the use of the fsid option (although that may still not be enough).

Obvious, and self-explanatory, isn’t it? If you happened to have this “Stale NFS file handle” problem and your exported NFS file systems were on a LVM volume, adding fsid for each exported filesystem should help:


Note: if this error only happens when accessing certain files, this means that your (non-network) filesystem is broken:

# rm fCVS
rm: cannot remove `fCVS': Stale NFS file handle

In this case, running fsck is recommended.