The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data.[1] File-system object attributes may include metadata (times of last change,[2] access, modification), as well as owner and permission data.[3]

A directory is a list of inodes with their assigned names. The list includes an entry for itself, its parent, and each of its children.


There has been uncertainty on the Linux kernel mailing list about the reason for the "i" in "inode". In 2002, the question was brought to Unix pioneer Dennis Ritchie, who replied:[4]

In truth, I don't know either. It was just a term that we started to use. "Index" is my best guess, because of the slightly unusual file system structure that stored the access information of files as a flat array on the disk, with all the hierarchical directory information living aside from this. Thus the i-number is an index in this array, the i-node is the selected element of the array. (The "i-" notation was used in the 1st edition manual; its hyphen was gradually dropped.)

A 1978 paper by Ritchie and Ken Thompson bolsters the notion of "index" being the etymological origin of inodes. They wrote:[5]

[…] a directory entry contains only a name for the associated file and a pointer to the file itself. This pointer is an integer called the i-number (for index number) of the file. When the file is accessed, its i-number is used as an index into a system table (the i-list) stored in a known part of the device on which the directory resides. The entry found thereby (the file's i-node) contains the description of the file.

Additionally, Maurice J. Bach wrote that an inode "is a contraction of the term index node and is commonly used in literature on the UNIX system".[6]


File descriptors, file table and inode table in Unix[7]
File descriptors, file table and inode table in Unix[7]

A file system relies on data structures about the files, as opposed to the contents of that file. The former are called metadata—data that describes data. Each file is associated with an inode, which is identified by an integer, often referred to as an i-number or inode number.

Inodes store information about files and directories (folders), such as file ownership, access mode (read, write, execute permissions), and file type. On many older file system implementations, the maximum number of inodes is fixed at file system creation, limiting the maximum number of files the file system can hold. A typical allocation heuristic for inodes in a file system is one inode for every 2K bytes contained in the filesystem.[8]

The inode number indexes a table of inodes in a known location on the device. From the inode number, the kernel's file system driver can access the inode contents, including the location of the file, thereby allowing access to the file. A file's inode number can be found using the ls -i command. The ls -i command prints the i-node number in the first column of the report.

Some Unix-style file systems such as ZFS, OpenZFS, ReiserFS, btrfs, and APFS omit a fixed-size inode table, but must store equivalent data in order to provide equivalent capabilities. The data may be called stat data, in reference to the stat system call that provides the data to programs. Common alternatives to the fixed-size table include B-trees and the derived B+ trees.

File names and directory implications:

The operating system kernel's in-memory representation of this data is called struct inode in Linux. Systems derived from BSD use the term vnode (the "v" refers to the kernel's virtual file system layer).

POSIX inode description

The POSIX standard mandates file-system behavior that is strongly influenced by traditional UNIX file systems. An inode is denoted by the phrase "file serial number", defined as a per-file system unique identifier for a file.[9] That file serial number, together with the device ID of the device containing the file, uniquely identify the file within the whole system.[10]

Within a POSIX system, a file has the following attributes[10] which may be retrieved by the stat system call:


Filesystems designed with inodes will have the following administrative characteristics.


It can make sense to store very small files in the inode itself to save both space (no data block needed) and lookup time (no further disk access needed). This file system feature is called inlining. The strict separation of inode and file data thus can no longer be assumed when using modern file systems.

If the data of a file fits in the space allocated for pointers to the data, this space can conveniently be used. For example, ext2 and its successors store the data of symlinks (typically file names) in this way if the data is no more than 60 bytes ("fast symbolic links").[12]

Ext4 has a file system option called inline_data that allows ext4 to perform inlining if enabled during file system creation. Because an inode's size is limited, this only works for very small files.[13]

In non-Unix systems

See also


  1. ^ Tanenbaum, Andrew S. Modern Operating Systems (3rd ed.). p. 279.
  2. ^ JVSANTEN. "Difference between mtime, ctime and atime - Linux Howtos and FAQs". Linux Howtos and FAQs.
  3. ^ "Anatomy of the Linux virtual file system switch".
  4. ^ Linux Kernel list archive. Retrieved on 2011-01-12.
  5. ^ Ritchie, Dennis M.; Thompson, Ken (1978). "The UNIX Time-Sharing System". The Bell System Technical Journal. 57 (6): 1913–1914. Retrieved 19 December 2015.
  6. ^ Maurice J. Bach (1986). The Design of the UNIX Operating System. Prentice Hall. ISBN 978-0132017992.
  7. ^ Bach, Maurice J. (1986). The Design of the UNIX Operating System. Prentice Hall. p. 94.
  8. ^ "linfo". The Linux Information Project. Retrieved 11 March 2020.
  9. ^ "Definitions - 3.176 File Serial Number". The Open Group. Retrieved 10 January 2018.
  10. ^ a b "<sys/stat.h>". The Open Group. Retrieved 15 January 2018.
  11. ^ "What is the Unix command to create a hardlink to a directory in OS X?". Stack Overflow. 16 Jan 2011. Archived from the original on 5 January 2020. Retrieved 5 Jan 2020.
  12. ^ "The Linux kernel: Filesystems".
  13. ^ "Ext4 Disk Layout". Retrieved August 18, 2013.
  14. ^ "Does Windows have Inode Numbers like Linux?". Stack Overflow.
  15. ^ a b c "GetFileInformationByHandle function (fileapi.h) - Win32 apps".
  16. ^ "[MS-FSCC]: NTFS Attribute Types".
  17. ^ "Windows - Maximum size of file that can be stored entirely in NTFS Master File Table (MFT)".