How to see actual filename that File Descriptor is pointing to for a given processID?


 
Thread Tools Search this Thread
Operating Systems Solaris How to see actual filename that File Descriptor is pointing to for a given processID?
# 15  
Old 12-08-2010
Quote:
So you mean lsof doesn't show the filename for a given inode number pair, but find found a real pathname for the same inode ?
I did some more testing. "find / -inum <INODE> -print" command is finding actual file names that are not showing up in 'lsof' output sometimes, still for many indoes its returning empty output [ 100% of time still shows a entry under /proc/<PID>/fd/<FD> ].

Whatever the intent and concept may be for this hiding,, I am getting headache.

Last edited by kchinnam; 12-08-2010 at 12:13 PM.. Reason: clarification
# 16  
Old 12-08-2010
Quote:
Originally Posted by kchinnam
Whatever the intent and concept may be for this hiding,, I am getting headache.
There is no intent or concept. "lsof", at least on Solaris, is an unsupported third party hack. As far as I know, it directly accesses undocumented kernel structures from /dev/kmem.

What is the problem you are trying to solve by investigating your processes open files ?
# 17  
Old 12-09-2010
Quote:
What is the problem you are trying to solve by investigating your processes open files ?
For a manual disaster recovery project[to a different data center], we are trying to understand the scope. \\
What if we take a full backup of disk used by running apps, while they are still running. \\
What are all the runtime files that might get affected. Just to have an idea, in case if stopping all apps \\
is not feasible due to downtime and other ill effects..

Last edited by kchinnam; 12-09-2010 at 12:39 AM.. Reason: formatting
# 18  
Old 12-09-2010
That seems quite risky depending on the application, especially if the backup of evolving files isn't strictly synchronous.
# 19  
Old 12-09-2010
Quote:
Originally Posted by jlliagre
That seems quite risky depending on the application, especially if the backup of evolving files isn't strictly synchronous.
Quite the understatement.

If the plan is to take some sort of snapshot of the raw disk underlying an active and mounted file system, there's no guarantee at all the the snapshot would be consistent or even mountable.

If the plan is to use something like ZFS snapshots, that would at least produce a consistent file system on the remote system(s). Then there would "only" be problems at the application level.
# 20  
Old 12-10-2010
The files under /proc are imaginary, but the flat files have names that disclose their inode and device. If you cannot "find" a path name (there may be several links), then there are no links, which is to say it has been removed but is still open on one or more processes. For instance, tmpfile() does this so if your proc crashes, the file space is released. Then, your only clue to the original path is the inode contents or the fd # implying an order of opening.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Actual SQL instead of using a file from within a shell script

I am very noobish to UNIX, our guy is on vacation so I am trying to take up some slack while he is away. Typically when we use sql from within a shell script, we do so from a file containing the sql. Example: $ORACLE_HOME/bin/sqlplus $ORA_DBCU/$ORA_DBCP @${cron_dir}/${report_file}.sql ... (10 Replies)
Discussion started by: biobill
10 Replies

2. Shell Programming and Scripting

redirecting with file descriptor

hello, Someone can help me with redirectors? I am writing this script in bash enviroment on Fedora: exec 4<> /dev/tcp/10.10.11.30/5000 #open socket in input/output strings<&4 >file.txt & I send file descriptor 4 to string command to purge data stream from special char while come from... (3 Replies)
Discussion started by: rattoeur
3 Replies

3. Shell Programming and Scripting

Unlink and copy actual file

Hello, I have a set of directories, which has inside them, symbolic links to some files. What i would like to do is to covert the links into actual files, i.e. remove the link and copy the actual file here... I tried to see unlink command but i think all it does is delete the link, is... (2 Replies)
Discussion started by: prasbala
2 Replies

4. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

5. Shell Programming and Scripting

Open the file and replace the variable with actual value

Hi, i have a sql file named sample.sql. The query is given below. select count(*) from $TABLE_NAME In the main script, i am sourcing this sql. I need to replace the $TABLE_NAME with actual value, before running the query. How can i achieve that? The logic i tried is given below:... (3 Replies)
Discussion started by: bharathappriyan
3 Replies

6. Shell Programming and Scripting

How to create a user interface pointing to a file?

I have to create a user interface in which user can easily update ,delete or insert a new record which is pointing to a file in AIX Server? Using awk,sed ican update ,modify the file. how to create a link to userlike GUI(without using Tomcat,IIS) (3 Replies)
Discussion started by: laknar
3 Replies

7. UNIX for Dummies Questions & Answers

File Descriptor

Hi What the below path contains? /proc/<pid>/fd (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

8. Shell Programming and Scripting

File Descriptor

Hello All, Im opening a file desciptor in perl and sending data using print CMD "$xyz". is there a limit to the length of the string that I can give to this CMD at a time. (3 Replies)
Discussion started by: rimser9
3 Replies

9. UNIX for Dummies Questions & Answers

File Descriptor Help

What is a file descriptor in Unix?? How to find a file descriptor of a file in Unix?? Does it have anything to do with the Inode numbers?? (3 Replies)
Discussion started by: rahulrathod
3 Replies

10. UNIX for Dummies Questions & Answers

file activity (open/closed) file descriptor info using KORN shell scripting

I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)
Discussion started by: Gary Dunn
3 Replies
Login or Register to Ask a Question