SUMMARY: NFS stale handles.

From: Kai O'Yang (oyang@mars.fcit.monash.edu.au)
Date: Mon Apr 28 1997 - 18:34:36 CDT


Hi,

This list is most helpful. Thanks to:

Dave Blackman,
Bismark Espinoza and
Jochen Bern.

I'm now able to decode what those Stale NFS file handle:
(file handle: 80000e 2 a0000 a2b40 6c32949a a0000 2 2fede13) mean.

For SunOS4, use showfhd(8), but I'm using Solaris, so..., but
Dave Blackman was very kind to send me the fhfind script from Sun's InfoDoc to
look up the mapping. (The original missed some ; and | which I've corrected as
listed below.)

Thanks a bunch,
Kai

-----begin cut here-----
#!/bin/sh
#
# fhfind: takes the expanded filehandle string from an
# NFS write error or stale filehandle message and maps
# it to a pathname on the server.
#
# The device id in the filehandle is used to locate the
# filesystem mountpoint. This is then used as the starting
# point for a find for the file with the inode number
# extracted from the filehandle.
#
# If the filesystem is big - the find can take a long time.
# Since there's no way to terminate the find upon finding
# the file, you might need to kill fhfind after it prints
# the path.
#
 
if [ $# -ne 8 ]; then
        echo
        echo "Usage: fhfind <filehandle> e.g."
        echo
        echo " fhfind 1540002 2 a0000 4df07 48df4455 a0000 2 25d1121d"
        exit 1
fi
 
# Filesystem ID
 
FSID1=$1
FSID2=$2
 
# FID for the file
 
FFID1=$3
FFID2=`echo $4 | tr [a-z] [A-Z]` # uppercase for bc
FFID3=$5
 
# FID for the export point (not used)
 
EFID1=$6
EFID2=$7
EFID3=$8
 
# Use the device id to find the /etc/mnttab
# entry and thus the mountpoint for the filesystem.
 
E=`grep $FSID1 /etc/mnttab`
if [ "$E" = "" ]; then
        echo
        echo "Cannot find filesystem for devid $FSID1"
        exit 0
fi
 
set - $E
MNTPNT=$2
 
INUM=`echo "ibase=16; $FFID2" | bc` # hex to decimal for find
 
 
echo
echo "Now searching $MNTPNT for inode number $INUM"
echo
 
find $MNTPNT -mount -inum $INUM -print 2>/dev/null
-----end cut------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:51 CDT