inode number -> pathname? (4.2BSD)

Daniel R. Levy levy at ttrdc.UUCP
Sun Jul 14 12:27:06 AEST 1985


guy at sun.uucp (Guy Harris) <2414 at sun.uucp>:
>
>> >I am looking for a good way to generate the full path name of a directory, 
>> >given only its inode number (plus the device number of its filesystem).
>> How about:
>> 
>> 	find / -inum inode-number -print
>
>Well, this is even slower than "ncheck", and will report *all* files that
>have that inumber; remember, the problem was "translate a device/inumber
>*pair* to the directory with that inumber *on that device*".
>
>	Guy Harris
>
>P.S. 4.xBSD is the only UNIX that documents "-inum" but I think it's been in
>there since V7 and is thus in S3 and S5 as well.
>

'Scuse me, Guy (I've been landed on with both feet before by several users
when I asked a mild question about something you said earlier, so I am try-
ing to be cool about this) but why not 

find /file_system -inum inode_# -print [maybe -exec ls -l {} \;]

which would restrict the search for the inum to the file system on the device
in question?  That would be a bit quicker than searching all filesystems, as
a find on root would do.  A mount command would show what's mounted on what,
so you'd know which filesystem to search.

Sorry if I misunderstand.  Please readers if you answer don't just holler
'Guy knows his Unix' this time.  Maybe it's still slower than ncheck (I
haven't timed it yet).

thanks.

dan levy
at&t teletype corp
skokie ill
..!ihnp4!ttrdc(!ttbcad)!levy



More information about the Comp.unix.wizards mailing list