Showing results for 
Search instead for 
Did you mean: 


Go to solution
Frequent Advisor



Can you define inodes and how it is being used in hp for troubleshooting and the relation on on lost+found directories while fsck.

thanks in advance
Honored Contributor

Re: inodes

In a unix-style filesystem, a file can have multiple names if it has multiple hard links (directory entries) pointing to it. Therefore, the fundamental identifier for the file is *not* the filename, but the inode number.

The inode itself is a filesystem meta-data structure that contains the basic information about the file: how to find the file's data blocks on the disk, the file's length, timestamps, permissions and ownership information.

Usually the filesystem is allowed to manage the inode numbers, because filenames are so much more convenient for humans.

But if someone has accidentally created a file that has a strange name (e.g. it contains strange Unicode characters you cannot properly display or type), you can use "-inum" option of the find command to manipulate the file based on its inode number.

Also if filesystem's directory structure is corrupted so that the names of some files are completely lost, the fsck will rescue such orphaned files by placing them into the filesystem's /lost+found directory and giving them new names that match their inode numbers. The inode numbers are guaranteed to be unique on the disk, so the generated names should not collide with anything that already exists in /lost+found.

The sysadmin must then try and identify the files, based on the file content and ownership information.

James R. Ferguson
Acclaimed Contributor

Re: inodes


To add to Matti's excellent post, an inode number is only unique within a filesystem. That is, a file in the mounted '/usr' filesystem can have the same inode number as a file in the mounted '/opt' filesystem.

Therefore, be very careful if you are searching a removing files by inode number. Doing a 'find()' in the '/' directory would visit all subordinate mountpoints unless you used the '-xdev' option to confine searching to the '/' mountpoint (which would include the '/etc', and '/sbin' directories since they are not mountpoints).

It can be useful to know, too, that the inode number of a mounted filesystem is always two (2).