How can I get only FileName associated with a INODE on Unix much faster?

How can I get only FileName associated with a INODE on Unix[solaris8] in seconds instead of minutes, as it is the case for me as shown below.

 
# Say I have FileDescriptor: 43, INODE: 2590784, File: abc.rdb. I want to get only filename associated with inode:2590784 and FD:43.
$> time find / -inum 2590784 -print 2>/dev/null 
/export/<full_path>/abc.rdb      # This is what I want in seconds or milliseconds.
/proc/4012/fd/43                 # Where 4012 is PID
/proc/4012/object/ufs.85.3.2590784
 
real    2m26.91s
user    0m2.23s
sys     0m30.29s

try adding the -xdev option assuming the file is on /

with -xdev whatever output I was getting earlier disappeard. So that can't be it.

I am wondering if my problem requires something like a C-shell program that talks to Unix kernel.

you must have missed my "assuming the file is on /" comment.

try

time find /export -inum 2590784  -xdev -print 2>/dev/null

you can also add -fstype ufs (or whatever your using) to avoid traversing the proc file system. your searching my inode so if you use / it will search all file systems. I suggest you limit your search to the file system that has your file.

Thanks Frank, that helped. I am getting it in around 16seconds.

 
$> time find /export -inum 2590784  -xdev -fstype ufs -print 2>/dev/null
/export/<full_path>/abc.rdb
 
real    0m16.28s
user    0m1.56s
sys     0m13.36s

Sorry for being too greedy, are there any other ideas to make this more quick? Since I may have to get this output for about 1000+ INODEs that are active in the runtime?

it's an expensive search. if the files are relatively static you might be able to build an index file mapping the nodes to paths and then just grep the inode out of that file. just a quick thought.

You could specify the type of file (in case your aware)(-type) in the find command. So that it filter only the type of files you look for and save a few seconds..just another thought :wink:

Thanks, I will work with what I have so far.