To grab the inode of a file in PHP, you can use this:
$fs = stat($file);
echo $fs['ino'];
The problem with this is EVERYWHERE says it's slow and you should avoid it. So the question becomes what's the fast(er) way to do it?
...
Hi,
my partition /tmp is full... and its empty at the same time.
So the partition is full.
Check the directory:
# du -sh /tmp
28K /tmp
What? It is empty...
And it is really empty... just two empty directories are located in /tmp
Checking partition details:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0...
I have a directory with 500,000 files in it. I would like to access them as quickly as possible. The algorithm requires me to repeatedly open and close them (can't have 500,000 file open simultaneously).
How can I do that efficiently. I had originally thought that I could cache the inodes and open the files that way, but *nix doesn't...
I know that in Unix (specifically, Mac OS X) the superblock stores information about the layout of data on the disk, including the disk addresses at which the inodes begin and end. I want to scan the list of inodes in my program to look for deleted files. How can I find the disk address at which the inodes begin? I have looked at the ...
How do I find out which directories are responsible for chewing up all my inodes?
Ultimately the root directory will be responsible for the largest number of inodes, so I'm not sure exactly what sort of answer I want..
Basically, I'm running out of available inodes and need to find a unneeded directory to cull.
Thanks, and sorry for t...
Hi,
I have a disk drive where the inode usage is 100% (using df -i command).
However after deleting files substantially, the usage remain 100%.
What's the correct way to do it then?
How is it possible that a disk drive with less disk space usage can have
higher Inode usage than disk drive with higher disk space usage?
...
I'm writing a program that will be monitoring select files and directories for changes. Some of the files are world writeable, some owner, some group.
What I need to do is be able to figure out the last person to modify (not just access) a file. Somehow I thought this would be simple, given that we know the inode of the file .. however ...
Someone is FTPing a file of size 10Mb to folder on a linux server.
While the file is in transition a cron wakes up and fires off a Perl script that is designed to look at the ftp folder and move whatever it finds there to some alternate folder. I'm using the move() function from File::Copy. The Perl process actually renames the files as...
I am flabbergasted by the definition of the inode number:
An inode is a data structure on a traditional Unix-style file system
such as UFS or ext3. An inode stores basic information about a regular
file, directory, or other file system object. Source
So there must be a logical order in every inode number. Can you conclude somet...
I have a file that was deleted, but is still held open my a program. I found the inode number using lsof. How can I create a hard link back to that inode?
Any code helps, but Perl would be handy.
...
Why does /cdrom has the same inode -number than /sys/devices/platform/power in Ubuntu?
The following have the same inode number in my Ubuntu
./media/BACKUP_1/MISC
./cdrom
./sys/devices/platform/power
I get them by running the following at root
find . -inum 12 2> /dev/null
Reply to Leffler's answer
I run
stat cdrom
I get
F...
The only way I know is:
find /home -xdev -samefile file1
But it's really slow. I would like to find a tool like locate.
The real problems comes when you have a lot of file, I suppose the operation is O(n).
...
There are plenty of articles on the web detailing why you might not want to use Apache's default inode-mtime-size format for ETags.
But I have yet to read anything on what might have motivated the inclusion of inode for Apache in the first place. On the face of it, it only seems useful if one needs to be able to differentiate between oc...
I understand that a directory is just a file in unix that contains the inode numbers and names of the files within. How do I take a look at this? I can't use cat or less on a directory, and opening it in vi just shows me a listing of the files...no inode numbers.
...
In a linux kernel module (i.e. working in kernel space), I have a path of a file.
Which function(s) can be used to get the inode of that file. Specifically I need to get the "inode *" pointing to the file's inode.
...
We are using Amazon EBS to store a large number of small files (<10KB) in a 3-level directory structure.
~/lists# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 3.9G 5.5G 42% /
tmpfs 854M 0 854M 0% /lib/init/rw
varrun 854M 64K 854M 1% /var/run
varlo...
The C language convention counts array indices from 0. Why do inode numbers start from 1 and not 0?
If inode 0 is reserved is for some special use, then what is the significance of inode 0?
...
How to get directory inode number say /home/laks/file.txt
I need the inode number of laks directory. Any built-in function is already available?
I think i could use stat() if i cut the file name...but any other solution to this without removing file name.
...
Are the inode limits on Linux by subdirectory or by the entire file system? I use ububtu 64 bit server 9.10.
Can the inode limit be resolved by splitting files up into multiple sub directories if it's a directory limit?
...
From http://en.wikipedia.org/wiki/Inode
Unix directories are lists of "link"
structures, each of which contains one
filename and one inode number.
I'd like to just get the length of this list of links, the names of the files in the directory aren't important at this point in my code.
A solution in Perl would be preferred, but ...