Mapping pfiles output to files

While I was analyzing the performance characteristics of one of my Solaris 9 Oracle database servers, I needed to map a file descriptor listed in the pfiles output to the actual file name on the file system (Solaris 10 provides this information in the pfiles output, which is yet another reason to run Solaris 10). When you run pfiles on a process or core file, it gives you the type (e.g., socket, fifo, regular file, etc) of file that the file descriptor references, and the inode number associated with the file:

$ pfiles 12345

  [ ..... ]

 269: S_IFREG mode:0660 dev:228,119007 ino:61 uid:102 gid:315 size:10729046016
  [ ..... ]

To map the inode listed after the “ino:” field to the file name, I first used the “dev:” identifier to locate the device the file was located on:

$ cd /dev/vx/dsk/foodg

$ ls -la

total 4
drwxr-xr-x   2 root     root         512 Sep 18  2005 .
drwxr-xr-x   5 root     root         512 Sep 18  2005 ..
brw-------   1 root     root     228,119000 Sep 18  2005 u16
brw-------   1 root     root     228,119001 Sep 18  2005 u17
brw-------   1 root     root     228,119002 Sep 18  2005 u18
brw-------   1 root     root     228,119003 Sep 18  2005 u19
brw-------   1 root     root     228,119004 Sep 18  2005 u20
brw-------   1 root     root     228,119005 Sep 18  2005 u57
brw-------   1 root     root     228,119006 Sep 18  2005 u58
brw-------   1 root     root     228,119007 Sep 18  2005 u59
brw-------   1 root     root     228,119008 Sep 18  2005 u60
brw-------   1 root     root     228,119009 Sep 18  2005 u61
brw-------   1 root     root     228,119010 Sep 18  2005 u62
brw-------   1 root     root     228,119011 Sep 18  2005 u63
brw-------   1 root     root     228,119012 Sep 18  2005 u64
brw-------   1 root     root     228,119013 Sep 18  2005 u65
brw-------   1 root     root     228,119014 Sep 18  2005 u66

Once I had the device name and associated mount point, I used the trusty old find utility to locate the file by it’s inode number:

$ find /u59 -inum 61 -ls

   61 10477592 -rw-rw----   1 oracle   dba      10729046016 Sep 18 13:15 /u59/oradata/blatch/data01.dbf

Some folks might be wondering why I didn’t use lsof. Well, unfortunately the version of lsof available in various package repositories isn’t able to interpret the VxFS metadata, and I would have spent more time building the new package than analayzing the problem I was trying to solve. Viva la Solaris!

5 thoughts on “Mapping pfiles output to files”

  1. Hey Paul –
    He’s showing you the device id/mount associated with the dev: column in the pfiles output. Inside of veritas, all devices will show in : /dev/vx/dsk/ just like outside over vertias control all disks will show in /dev/dsk which are just symlinks back to their respective location in /devices.

    He probably should have showed this instead: ls -la /dev/vx/dsk/*/*

    as well as:

    ls -la /dev/dsk/

    and then an ls -la on whatever is on the right side of the symlinks that show up

    Hope that helps!

  2. Hello all, thanks for topic ..
    … but I have one question: what if this file is already deleted and file handler stayed opened.
    I know, via lsof this file should be visible, but not always you have possibility to use lsof.

    Is in Solaris possibility to see the name of file from output of pfiles ?

    Thanks a lot and sorry for my english.

  3. thanks this is really useful.
    in our case the pfiles showed dev:273,1 but i could not find that major/minor anywhere under /dev and later came to know that is a NFS filesystem, is there way where we can match the dev number easily with the filesystem. (including NFS) ?

  4. only problem with the seek meohtd is that it doesn’t show as taking up space when running df for a volume.Im trying to test the removal of large old files from a script and it would have been ideal but sadly no.I have only found the /dev/zero to block meohtd to work but this takes some time to create the files.strangely this is well possible using the fsutil command line command in windows. Im sure there is a way to create quick large test files that work with a df under linux. please post if you know how.

Leave a Reply

Your email address will not be published. Required fields are marked *