Is there a tool for translating file handles to file names on Solaris 10?

I've looked around and found several scripts including the one at: http://heim.ifi.uio.no/kjetilho/hacks/fhfind.perl https://groups.google.com/forum/#!topic/comp.unix.solaris/JixDbMSIdws

The first returns:

$ fhfind.pl  60000000 db18ad03 20080000 1bcba9 6cf2d513 d4d3d955 60000000 db18ad00
Sorry, can't find device.

The second returns:

$ fhfind  60000000 db18ad03 20080000 1bcba9 6cf2d513 d4d3d955 60000000 db18ad00
Cannot find filesystem for devid 60000000

Neither seem to work on Solaris 10 and are quite dated.

  • I don't have solaris, but generally if you look at an NFS file handle, you can find the inumber is embedded inside it at a particular (OS-dependent) offset, as well as the st_rdev corresponding to the underlying file system. From that you can use a utility like ncheck or find /wherever -xdev -inum NNN to find links to the file. My guess is that the file handle format changed since those scripts were written. Aug 17 '15 at 8:03
  • Also be aware that posting NFS file handles publicly potentially opens you up to attack, if someone can get packets to port 2049 of your server, especially if the file handle happens to correspond to a directory. If you are at all worried about security, the fsirand program will re-randomize your generation numbers. Aug 17 '15 at 8:07
  • As @user3188445 pointed out, the file handle format has likely changed. Worth reverse-engineering it to figure out the format on your release/platform, see good example at syslog.eu/stale-nfs-file-handle-sparc-zfs
    – steve
    Aug 17 '15 at 8:26
  • @steve, just wondering, what is the date on that post? Is that year 2015? It looks interesting, but I don't get a hit in the first instance... the echo | memstat command doesn't look like it matches anything for me.
    – user55570
    Aug 19 '15 at 4:57
  • Date on that post is April 2013 (see syslog.eu/2013/04). Did you mean echo ::nfs_exptable | mdb -k rather than echo | memstat ?
    – steve
    Aug 20 '15 at 9:31

Not sure where you're getting your file handle from, or end goal. Have you looked to see if using pfiles to gather data from the proc table gives you what you're looking for?

  • here's an example NFS error where file handle is reported and a filename translation would be helpful: nfs: [ID 626546 kern.notice] NFS write error on host Stale NFS file handle. nfs: [ID 702911 kern.notice] (file handle: 60000000 c716ad03 20080000 10f863 b5f6ba05 6c35cb55 60000000 c716ad00)
    – user55570
    Jan 29 '17 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.