Frequently Asked Question

What is an inode and why does df sometimes say a disk is full when it isn't?

Every file on a Unix filesystem has an inode, an on-disk record holding its metadata (size, owner, permissions, timestamps, link count) and pointers to the data blocks that hold its actual contents. Filenames live in directory entries, which are nothing more than (name, inode-number) pairs. Two hard links share an inode; renaming a file changes the directory entry, not the inode. You can see the inode number with ls -i, and detailed metadata with stat.

On ext4 and similar filesystems the number of inodes is fixed at format time, usually one inode per 16 KB of disk space. If you create millions of tiny files, caches, mail spools, version-control objects, you can exhaust the inode pool while plenty of free blocks remain. df -h will show the partition with space, but every touch or cp fails with "No space left on device". Run df -i to see inode usage; the fix is usually to delete files, not free space. Newer filesystems like btrfs and xfs allocate inodes dynamically and don't have this failure mode.

Video

Further reading and video