Skip to main content
RunBook Academy

LinuxXIV · FilesystemsOperations

Inode exhaustion - the filesystem that says no

Intermediate⏱ ~8 minbashdf -ifinddu

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

Not yet marked complete on this device.

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

Read-only / Safedf -i
$ df -i /var
Filesystem     Inodes  IUsed   IFree IUse% Mounted on
/dev/sda2      5000000 4999980      20  100% /var

Where inodes go

Read-only / Safefile count
$ for d in /var /tmp /home; do echo -n "$d: "; find $d -xdev | wc -l; done
/var: 45231
/tmp: 1203
/home: 87
Read-only / Safeinode hot spots
$ 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: 4567

Diagnosing and resolving

  1. Run df -i to confirm inode exhaustion (IFree near 0)
  2. Find the mountpoint consuming the most inodes: df -i per mount
  3. Find directories with many files: find /mount -xdev -type f | wc -l per top-level dir
  4. Identify the consumer: usually /var/cache, /var/spool/postfix/maildrop, /var/log/journal
  5. Delete stale entries: apt clean, rotate logs, drop mail
  6. Verify recovery: df -i
  7. 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

  1. Q1. The filesystem has free space but says "No space left on device" on file creation. What is the most likely cause?

  2. Q2. ext4 fixes its inode count at mkfs time, while XFS allocates inodes on demand.

  3. Q3. Which of the following are correct for inode exhaustion? Select all that apply.

Passing score: 75%. Answers are checked in this browser.