← Back to Blog
DevOps November 10, 2026

"Disk Full" But `df -h` Shows 60% Free: Diagnosing Inode Exhaustion

Your monitoring alerts that a service is failing to write files. You SSH in, run df -h, and the partition shows plenty of free space. Applications are throwing No space left on device errors, but the disk isn't full in the byte sense. This is inode exhaustion — the filesystem ran out of index entries for files, not actual storage. It commonly strikes mail spools, application cache directories, CI/CD workspaces, and any system that creates millions of tiny files.

The 5-minute diagnosis

First, confirm inode usage with df -i instead of df -h:

df -i /var /tmp /home

If IUse% hits 100%, that's your problem. Now find the culprit directory:

# Count files per directory on the affected filesystem.
# -xdev keeps it on one filesystem; adjust the path to the full partition.
find / -xdev -printf '%h\n' 2>/dev/null | sort | uniq -c | sort -k 1 -rn | head -20

This prints the directories with the most files. In a real incident I saw this identify a single /var/spool/postfix/deferred/ directory holding 1.2 million message files from a misconfigured relay.

To see total inode capacity and usage for a specific ext4 partition:

tune2fs -l /dev/sda1 | grep -i inode

You'll see something like:

Inode count:              655360
Free inodes:              0

The fix: immediate relief + long-term prevention

For immediate relief, delete the offending files:

# Nuclear option for the worst directory (use with extreme care):
find /var/spool/postfix/deferred/ -type f -delete

# Safer: delete only files older than 7 days
find /var/spool/postfix/deferred/ -type f -mtime +7 -delete

For long-term prevention, if you're building new partitions where you expect many small files, increase the inode ratio at format time:

# Default is ~1 inode per 16KB. Change to 1 per 4KB for file-heavy workloads:
mkfs.ext4 -i 4096 /dev/sdb1

If the partition is already live and you can't reformat, consider moving the offending application to a filesystem with a better inode ratio, or use XFS instead (XFS allocates inodes dynamically up to the filesystem size, so it doesn't suffer from this class of failure):

mkfs.xfs /dev/sdb1
mount -o noatime /dev/sdb1 /mnt/high_file_count

Why it works

ext4 allocates a fixed number of inodes at mkfs time based on the -i (bytes-per-inode) parameter. Each file — regardless of size — consumes exactly one inode. Once all inodes are allocated, the kernel returns ENOSPC even if data blocks remain free. XFS allocates inodes on-demand from the free block pool, which is why it's immune to this specific failure mode.

Pro Tip

Add inode usage to your monitoring immediately with this one-liner for Prometheus node_exporter textfile collector:

# /etc/node_exporter/textfiles/inodes.prom
for fs in $(df -i --output=source,fstype,target | tail -n +2 | awk '$2!="tmpfs" && $2!="devtmpfs" {print $1}'); do
  usage=$(df -i "$fs" | awk 'NR==2 {gsub(/%/,""); print $5}')
  echo "filesystem_inode_usage_percent{mount=\"$fs\"} $usage"
done > /var/lib/node_exporter/textfiles/inodes.prom

Then alert when filesystem_inode_usage_percent > 90. Most teams only monitor node_filesystem_avail_bytes — inode exhaustion is invisible to that metric and will silently brick production services until you check df -i.