Search code examples
data-structuresfilesystemsinode

What is the data structure of the Inode number like?


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 something directly from the numbers in the front?

4214970 0 drwx------  102 user  staff   3.4K Feb  2 22:34 new
5728909 0 drwx------    3 user  staff   102B Mar 25 22:11 new_new
5415906 0 drwx------   15 user  staff   510B Mar 19 02:28 stdout_TEST

If not, what kind of things you can know thanks to the data structure?


Solution

  • Can you conclude something directly from the numbers in the front?

    Not necessarily. Inodes are recycled.

    If not, what kind of things you can know thanks to the data structure?

    Check the header file containing the definition of the struct appropriate to the specific filesystem (e.g. /usr/include/linux/ext2_fs.h for ext2 and ext3).