Ask a Question related to UNIX Programming, Design and Development.
-
S Derman #1
Locate a file by Inode
This there a way with UNIX to locate a file by inode if you know the
inode information?
I'd like to do this on Darwin.
Thanx in advance for any help.
SD.
S Derman Guest
-
#26241 [Csd->Bgs]: fopen fails to locate file
ID: 26241 Updated by: abies@php.net Reported By: Brad dot Youngblood at 4S dot com -Status: Closed +Status: ... -
#26241 [Opn->Fbk]: fopen fails to locate file
ID: 26241 Updated by: abies@php.net Reported By: Brad dot Youngblood at 4S dot com -Status: Open +Status: ... -
#26241 [NEW]: fopen fails to locate file
From: Brad dot Youngblood at 4S dot com Operating system: Windows NT PHP version: 4.3.3 PHP Bug Type: IIS related Bug... -
How to locate memory dump file
Dear, We are using SCO Unix 3.2 v 5.0.6. The system shut down by iteself this morning and got this message: Panic: K_trap - Kernal mode... -
How to locate the password file?
Hi, May I know how do I locate the password file for a database? I'm able to query the v$pwfile_users, and it shows a few users that has the... -
Arto V. Viitanen #2
Re: Locate a file by Inode
>>>>> "S" == S Derman <S> writes:
S> This there a way with UNIX to locate a file by inode if you know the
S> inode information?
Yes. Use the find command, like
siwenna% cd /etc/X11/fs
siwenna% ls -li
total 8
142831 -rw-r--r-- 1 root root 1562 Jul 1 08:11 config
109865 -rw-r--r-- 1 root root 1460 Oct 1 2002 config~
siwenna% df
Filesystem Size Used Avail Use% Mounted on
/dev/md0 16G 6.7G 9.1G 43% /
/dev/sda1 699M 41M 658M 6% /boot
siwenna% find / -inum 142831 -print
/etc/X11/fs/config
The catch is, you should give the root of the filesystem as the starting
point, since each filesystem has its own inode numbers.
--
Arto V. Viitanen [email]av@cs.uta.fi[/email]
University of Tampere, Department of Computer and Information Sciences
Tampere, Finland [url]http://www.cs.uta.fi/~av/[/url]
Arto V. Viitanen Guest
-
Martin Blume #3
Re: Locate a file by Inode
Arto V. Viitanen <av@cs.uta.fi> schriebSo this means, that given an inode number, a search could return more than>
> The catch is, you should give the root of the filesystem as the starting
> point, since each filesystem has its own inode numbers.
>
one file, because the same number may be used at the same time in different
filesystems?
Regards
Martin
Martin Blume Guest
-
Chuck Dillon #4
Re: Locate a file by Inode
Martin Blume wrote:
Yes, an inode is filesystem specific so if you search multiple file> Arto V. Viitanen <av@cs.uta.fi> schrieb
>>>>The catch is, you should give the root of the filesystem as the starting
>>point, since each filesystem has its own inode numbers.
>>
> So this means, that given an inode number, a search could return more than
> one file, because the same number may be used at the same time in different
> filesystems?
>
systems that inode can be found on any or all of them.
Also, there can be more than one link to the same inode in a file
system so even within a filesystem you can get any number of hits.
-- ced
--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Chuck Dillon Guest
-
Juha Laiho #5
Re: Locate a file by Inode
"Martin Blume" <mblume@socha.net> said:
It's also possible (and not even rare) for a single inode to have multiple>Arto V. Viitanen <av@cs.uta.fi> schrieb>So this means, that given an inode number, a search could return more than>> The catch is, you should give the root of the filesystem as the starting
>> point, since each filesystem has its own inode numbers.
>>
>one file, because the same number may be used at the same time in different
>filesystems?
names. The most common case for this is that every directory inode has
at least two names:
- base/dir
- base/dir/.
(as an example, see "ls -li /etc /etc/.")
.... but this is frequently used for files as well.
Another issue is that an existing and valid inode may have zero names.
These are commonly used as temporary files private to a process:
a process creates the file, and keeps it open while unlinking it.
This'll cause the inode to stay valid, but will lose the last name
pointing from the directory hierarchy to the inode. The inode will be
cleared when the last process holding it open closes it.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Juha Laiho Guest
-
Barry Margolin #6
Re: Locate a file by Inode
In article <webmaster-C69BD6.12595611072003@news.telus.net>,
S Derman <webmaster@derman.com> wrote:No. Two reasons:>Sorry, I was wondering if there was a system calls that would locate a
>file by inode number.
>
>Similar to open(path name,...), I'd like to open(inode num,...).
1) You would also need to supply the filesystem ID, since an inode number
is only unique within a filesystem.
2) It would allow you to get around directory permissions. Execute
permission on a directory controls whether you can open any files named
within it. If you could go directly to the file without specifying the
pathname, it wouldn't be able to check this.
--
Barry Margolin, [email]barry.margolin@level3.com[/email]
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Barry Margolin Guest



Reply With Quote

