logo       

SUMMARY: inode2filename: msg#00079

os.solaris.managers.summaries

Subject: SUMMARY: inode2filename

The winner is:

Michael.J.Watson@xxxxxxxxxxxxxx

who sent me a nifty little script that parses the pfile output,
to determine the inode, major, and minor numbers and then run
an appropriate ff command (similar to ncheck, see below)
unfortunately it didn't exactly work for me (think cause of
veritas)
also relies on a find command (but is limited to /dev tree)

the script is attached

the runner-up was:

Martin Schmitt [mas@xxxxxxx]

Who told me about the ncheck command.

ncheck -i <inode>
[root@server] ncheck -i 986876
/dev/vx/dsk/rootvol:
986876 /devices/pseudo/random@0:urandom

Caveaut:
ncheck still scans the file systems but the scan can be limited
to a specific FS
[root@server] ncheck -i 986876 /dev/vx/dsk/usr_local_vol
or to specific FS-Types (all ufs FSs in vfstab)
[root@server] ncheck -i 986876 -F ufs
you still need to know which FS the inode is on

basically, everybody else told me to run: "find /mount -inum <xxx> -print"
I prefer the pfiles/ff method since running find or ncheck on all my file
systems
which are fairly large, takes too long.

Bertrand_Hutin@xxxxxxxxxxxxxxxxxxx
Glass, David [david.glass@xxxxxxxxxxxx]
Bennett, Steve [s.bennett@xxxxxxxxxxxxxxx]
Hendrik Visage [hvisage@xxxxxxxx]
Tony_Schloss@xxxxxxxxxxxxxxx
Dominic Clarke [dominicc@xxxxxxxxx]
Urie, Todd [TUrie@xxxxxxxxxxxxxxxx]
Brett Lymn [blymn@xxxxxxxxxxxxxxxxx]
Lieven Marchand [lieven.marchand@xxxxxxxxxxxx]
Bob Rahe bob@xxxxxxxx
George Schlossnagle [george@xxxxxxxxxx]
Jeff Horwitz [jhorwitz75@xxxxxxxxx]
Kevin Buterbaugh [Kevin.Buterbaugh@xxxxxxxxxxx]
adh@xxxxxxxxxxxxxxxxx
Darren Dunham [ddunham@xxxxxxxx]
Jay Lessert [jayl@xxxxxxxxxxxxxx]
Victor Belei [vbelei@xxxxxxxxxxxxxxx]

Again thanks to everybody for their quick responses.

BTW: The following people are not in their offices:

Brown, Rob [Rob@xxxxxxxxx]
Manohar Nayak [Manohar@xxxxxxxxxx]
RHEAULT, ROBERT R [ROBERT_R_RHEAULT@xxxxxxxxx]
Granzow, Doug (NIH/NCI) [granzowd@xxxxxxxxxxxx]
Vmer Cankardes [omeca@xxxxxxxxxxxxxx]
Karien Depijper [karien.depijper@xxxxxxxxxxxx]


--
Alan Miller
is:energy GmbH
Unit Operations, Operating Systems - OPOO
Tresckowstrasse 3
30457 Hannover
Telefon: (0511) 439-4292 Telefax: (0511) 439-4226
Email: alan.miller@xxxxxxxxxxxx I-Net: <www.is-energy.de>
# #!/bin/ksh
#
apNF() { nawk ' {print $NF} '; }
ap2() { nawk ' {print $2} '; }

if [ "`/usr/xpg4/bin/id -u`" != "0" ] ; then
echo
echo "This script doesn't run correctly unless run as root."
echo "...Exiting..."
echo
return 1
fi

rm /tmp/pfcn* 2>/dev/null

if [ -n "$1" ]
then
pfiles $1 > /tmp/pfcnv
else
echo
echo "Usage: >$0 <pid>"
echo
echo " Exiting."
echo
exit 1
fi
if [ $? -ne 0 ]
then
exit 2
fi

echo
echo "Starting pfile conversion script."
export PID=$1
echo "PID is $PID:"
# echo "`ps -ef | egrep $1 | awk '$2 == $PID {print $0}'`"
# For some reason, the above command should work but doesn't...?
echo
echo "Output format is:"
echo "Inode Filename Filesize Owner"
echo

egrep S_IF /tmp/pfcnv | cut -d: -f2- | sort -u | \
while read FT MODE DEV INO UID GID RDEV
do
MAJ=`echo $DEV | cut -d: -f2 | cut -d, -f1`
MIN=`echo $DEV | cut -d: -f2 | cut -d, -f2`
INO=`echo $INO | cut -d: -f2`
echo "$MAJ:$MIN\t\t$INO" >> /tmp/pfcnv2
done

for i in `cut -d" " -f1 /tmp/pfcnv2 | sort | uniq`;do
export INOLST=""
for k in `egrep $i /tmp/pfcnv2 | cut -c8- | sort -nu`;do
if [ -n "$k" ]; then
if [ -z "$INOLST" ]; then
INOLST=$k
else
INOLST="$INOLST,$k"
fi
fi
done
echo "$i\t\t$INOLST" >> /tmp/pfcnv3
done

cat /tmp/pfcnv3 | while read MM INOLST2
do
echo $MM | tr ":" " " | read MJ MN
if [ $MN -lt 10 ]; then
MN=" $MN"
elif [ $MN -lt 100 ]; then
MN=" $MN"
elif [ $MN -lt 1000 ]; then
MN=" $MN"
fi
CURRDEV=`find /devices -ls | egrep "$MJ,$MN" | egrep -v raw | nawk '{print
$12}'`
if [ -n "$CURRDEV" ]; then
/usr/sbin/ff -uls -i $INOLST2 `find /dev -ls | egrep $CURRDEV | egrep -v
rdsk | nawk '{print $11}'`
else
echo "Filesystem with numbers $MJ,$MN and inode(s) $INOLST were not
found."
echo
fi
done
rm /tmp/pfcn*


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise