Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

There is no usage guidance for this tag … yet!

Usage guidance, also known as a tag wiki excerpt, is a short blurb that describes when and why a tag should be used on this site specifically.

An inode (sometimes referred to as an index node) is the file structure as part of the metadata of many file systems. Each inode typically contains all the information about one file or directory, except its content and name.

The number of inodes (and thus total number of files and directories) is often fixed at filesystem creation; thus they're frequently over-provisioned. The mkfs default is typically several percent of the total size of the filesystem. The size of an individual inode varies by filesystem; Linux ext[234] uses 128- or 256-byte inodes, for example.

The metadata stored includes the following:

  • Inode number
  • Access Control List (ACL)
  • Extended attribute
  • Direct/indirect disk blocks (lists where the actual file contents is stored)
  • File access, change and modification time
  • File deletion time
  • File generation number
  • File size
  • File type
  • Group Number of links
  • Owner
  • Permissions
  • Status flags


$ touch "test1"
$ touch "test2"
$ ls -il test*
1079211 -rw-r--r-- 1 root users 0 Oct 12 15:13 test1
1079212 -rw-r--r-- 1 root users 0 Oct 12 15:13 test2

The first column is the inode. In addition, both stat and ls -i will give you the inode number. The find command can search for a file by inode number using -inum.

A file's inode does not store the file's name. (Indeed, hardlinked files share the same inode; a file can have many names). Instead, that is stored by the directory containing the file. If the filesystem is damaged, and the directory entries pointing to an inode are lost, fsck may re-connect the inode (often under a generated name) to "lost+found".

Each file on a filesystem has a unique inode number (though of course two files on two different filesystems can have the same inode number). As above, hardlinks (as created by ln) share the same inode, so this can be used to confirm two file names are hardlinked together.

Further reading

What is a Superblock, Inode, Dentry and a File?


Introduction to Inodes

history | excerpt history