Glossary

Inode

An inode ("index node") is the filesystem data structure that stores metadata about a file: its type, permissions, owner, size, timestamps, link count, and pointers to the data blocks on disk. The filename is not part of the inode—filenames are stored in directory entries, which map names to inode numbers. This separation is what makes hard links possible: two names pointing to the same inode.

You can see inode numbers with ls -i and inode usage with df -i:

ls -i /etc/passwd
df -i /                    # inode usage per filesystem
stat /etc/passwd           # full inode details

ext-family filesystems allocate a fixed number of inodes at mkfs time, so it is possible to run out of inodes on a filesystem that still has free blocks—a "no space left on device" error despite df showing free space. XFS, btrfs, and ZFS allocate inodes dynamically and do not suffer this. Finding inode hogs usually means hunting down directories with millions of tiny files, such as a broken cache or a runaway log rotation.

Inodes also expose subtle portability traps: when a file is deleted while still open, its directory entry vanishes but the inode lives until the last file descriptor closes. This is the idiom behind rm-ing a log file that a daemon is still writing to—freeing space requires a restart or truncate.

Related terms: Hard Link, ext4

Discussed in:

Also defined in: Textbook of Linux