NFS Services Administrator Guide (5900-3045, March 2013)

“Stale File Handle” Message
A “stale file handle occurs when one client removes an NFS-mounted file or directory that
another client is accessing. The following sequence of events explains how it occurs:
Table 19 Stale File Handle Sequence of Events
NFS client 2NFS client 1
% cd /proj1/source
1
% cd /proj1
2
% rm -Rf source
3
% ls
.:Stale File Handle
4
If a server stops exporting a directory that a client has mounted, the client will receive a stale
file handle error. Stale file handles also occur if you restore the NFS server’s file systems from
a backup or randomize the inode numbers with fsirand(1M).
If the stale file handle occurred because someone removed a file or directory that was in use,
or because a server stopped exporting a directory that was in use, follow these steps:
1. Enter the /usr/bin/cd command to move out of the NFS-mounted directory that is
causing the problem, then try unmounting the directory:
/usr/bin/cd /..
/usr/sbin/umount directory
2. If the directory cannot be unmounted because it is busy (in use), enter the following
commands to kill the processes using the directory and to try again to unmount it:
/usr/sbin/fuser -ck local_mount_point
/usr/sbin/umount local_mount_point
3. If the directory still cannot be unmounted, reboot the client.
4. To avoid stale file handles caused by users deleting NFS-mounted files, try using a source
code control system, like Revision Control System (RCS). A source code control system
allows only one user at a time to modify a file or directory, so one user cannot remove
files another user is accessing. For more information on the source code control system,
see rcsintro(5).
If someone has restored the server’s file systems from backup or entered the fsirand command
on the server, follow these steps on each of the NFS clients to prevent stale file handles by
restarting NFS:
1. Enter the mount(1M) command with no options, to get a list of all the mounted file systems
on the client:
/usr/sbin/mount
2. For every NFS-mounted directory listed by the mount command, enter the following
command to determine whether the directory is currently in use:
/usr/sbin/fuser -cu local_mount_point
This command lists the process IDs and user names of everyone using the mounted
directory.
3. Warn any users to cd out of the directory, and kill any processes that are using the
directory, or wait until the processes terminate. Enter the following command to kill all
processes using the directory:
/usr/sbin/fuser -ck local_mount_point
4. Enter the following command on the client to unmount all NFS-mounted directories:
Common Problems with NFS 97