Wednesday, 30 April 2014

NFS Stale File Handle Error and Solution


Sometime NFS can result in to weird problems. For example NFS mounted directories sometimes contain stale file handles. If you run command such as ls or vi you will see an error:
$ ls
.: Stale File Handle

NFS Stale:
A file handle 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).

How do I fix this problem?

a) The best solution is to remount directory from the NFS client using mount command.
umount -f /mnt/local
# mount -t nfs nfsserver:/path/to/share /mnt/local

2 comments: