Search code examples
linuxunixfilesystemsinode

why Inode number is different from computer to computer


I made a folder and file in it (in linux) and then I used the following command to get the Inode number of each file and directory:

ls -i -R

but when I use another computer with the same task I get different numbers for each inode, I know that it is reasonable but can everyone explain the reason of that? I mean why is the results different from computer to computer?


Solution

  • An inode (or index node) is a pointer/identifier used within the internal data-structure of a filesystem.

    As such, different computers have different filesystems - talking about the data, not the type/implementation! - and thus have different inodes values for a resource. An inode is an internal identifier while the path is the external identifier.

    As an analogy, imagine a C program in a modern operating system that mallocs a new object. The malloc returns a unique pointer within the process. However, many processes can share the same pointer value (when viewed as an integer address) while referring to completely unrelated objects.