Inode

An inode is a filesystem data structure that stores metadata about a file, including its size, permissions, and data block pointers, but excluding the filename.

An inode (index node) is a data structure in Unix-style filesystems that describes a file or directory. It stores metadata including file size, owner and group IDs, access permissions, timestamps, and pointers to the physical disk blocks. Notably, the filename is not part of the inode; it is stored in the directory structure and mapped to an inode number.

Filesystems allocate a specific number of inodes during formatting. Each file or directory consumes exactly one inode. A common failure scenario involves inode exhaustion, where the system cannot create new files despite having available disk space. This typically occurs on systems managing large volumes of small files, such as mail queues or session caches.

How it works

When a process requests a file, the kernel resolves the filename to an inode number via the directory entry. It then retrieves the file's attributes and block addresses from the inode table. Hard links are simply multiple directory entries pointing to the same inode. You can view inode numbers using the ls -i command.

Technical fact: In an ext4 filesystem, the default ratio is one inode per 16 KB of disk capacity. Monitoring inode usage is performed via df -i. If usage reaches 100%, services like syslog or databases will fail to write data, causing system instability.