LinuxXIV · FilesystemsOperations
Inode exhaustion - the filesystem that says no
What you'll learn
- Explain what inodes are and why they can run out
- Diagnose inode exhaustion on a production host
- Plan inode count when creating filesystems
- Reclaim inodes by deleting files
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
The disk is not full: df -h shows free space. But the
filesystem says No space left on device. The cause is inode
exhaustion: the filesystem has no free inodes to allocate to
new files.
What an inode is
An inode is a metadata structure that describes a file: type, permissions, owner, timestamps, size, and pointers to the data blocks. Every file on an ext2/3/4 or XFS filesystem consumes one inode. The number of inodes is fixed at filesystem creation time.
How inode exhaustion happens
$ df -i /varFilesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda2 5000000 4999980 20 100% /varWhere inodes go
$ for d in /var /tmp /home; do echo -n "$d: "; find $d -xdev | wc -l; done/var: 45231
/tmp: 1203
/home: 87$ for d in /var/cache /var/log /var/spool; do echo -n "$d: "; find $d -xdev -type f | wc -l; done/var/cache: 12345
/var/log: 234
/var/spool: 4567Diagnosing and resolving
- Run
df -ito confirm inode exhaustion (IFree near 0) - Find the mountpoint consuming the most inodes:
df -iper mount - Find directories with many files:
find /mount -xdev -type f | wc -lper top-level dir - Identify the consumer: usually /var/cache, /var/spool/postfix/maildrop, /var/log/journal
- Delete stale entries:
apt clean, rotate logs, drop mail - Verify recovery:
df -i - Long-term: reformat with more inodes via mkfs -N or -i, or use a filesystem with dynamic inode allocation (XFS)
Knowledge check
Knowledge check · 3 questions
Q1. The filesystem has free space but says "No space left on device" on file creation. What is the most likely cause?
Q2. ext4 fixes its inode count at mkfs time, while XFS allocates inodes on demand.
Q3. Which of the following are correct for inode exhaustion? Select all that apply.
Passing score: 75%. Answers are checked in this browser.