WHat is "Stale NFS handle"?

Guy Harris guy at auspex.UUCP
Fri Jan 20 06:37:31 AEST 1989


>I have a VAXstation 2000 running Ultrix 2.2, using NFS
>to use the /usr/local of a MicroVAX II, also running Ultrix.
>Yesterday, I could no longer access some files, and got the
>message "stale NFS handle".  What circumstances cause this?

A "file handle" (the message under SunOS, at least, is "stale NFS file
handle", not just "stale NFS handle") is the cookie used in NFS requests
to refer to a file.  For UNIX file servers, it's generally built out of:

	1) the major and minor device of the disk on which the file
	   system containing the file resides;

	2) the file's inumber;

	3) a "generation count" kept in the inode, and bumped every time
	   a new file gets that inode, so that a file handle referring
	   to a file that occupied that inode before the current file is
	   recognized as invalid - or "stale";

	4) some other stuff, perhaps.

A "stale" file handle is one that no longer validly refers to a file.

This can happen because:

	1) the file was removed out from under your application (the
	   inumber then refers to an empty slot in the ilist);

	2) the file was removed out from under your application, and
	   some newly-created file got assigned that inode (the
	   generation count then doesn't match);

	3) somebody decided to invalidate all existing file handles for
	   the file system on which the file resides (e.g., they didn't
	   want to make it available any more), which can be done with
	   "fsirand", a command that (at least on SunOS) stuffs random
	   numbers into the generation counts;

	4) the file system got trashed, so they had to restore it (which
	   changes the generation counts);

	5) somebody moved the disk partitions around on your server;

	6) the server stopped exporting the file system, or exported it
	   to a smaller set of servers not including yours;

	7) your server upgraded to a new version of the OS that changed
	   the way file handles are interpreted (I know the SunOS 3.x to
	   SunOS 4.0 upgrade did this);

	8) there's a bug in the server such that, for example, rebooting
	   the server invalidates file handles (there was such a bug in
	   an alpha version of SunOS 4.0, which was quite annoying; it
	   was, as far as I know, fixed later - as I remember it, the
	   problem was that instead of using the major/minor of the file
	   system's device in the file handle, it used the index of the
	   file system in the system mount table, which can change when
	   you reboot the machine);

	9) I'm sure there are some that I've forgotten.

If you can't get at *any* files on that file system, try unmounting it
and remounting it (if you get "stale NFS file handle" when unmounting,
you may have to reboot).



More information about the Comp.unix.questions mailing list