Resolving Linux Disk Partition Inode Exhaustion Causing 'No Space Left on Device' Errors

When a Linux disk partition's inode usage reaches 100%, websites may fail to create files with the error 'No space left on device'. This issue can be diagnosed using two commands:

df -h  # Shows disk space usage
df -i  # Displays inode usage

When disk space remains available but inodes are exhausted, consider these solutions:

1. Clearing High Inode Usage

To identify directories consuming excessive inodes:

for dir in /*; do echo "$dir: $(find "$dir" | wc -l)"; done

This reveals which directories contain the most files. Drill down further:

for subdir in /path/to/suspect/*; do echo "$subdir: $(find "$subdir" | wc -l)"; done

When removing large directories with many files, use xargs to avoid argument list limits:

find /problematic/directory -type f -print0 | xargs -0 rm -f

2. Increasing Available Inodes

This requirse reformatting the filesystem with higher inode allocation during creation.

Key Differences Between df -h and df -i

  • df -h: Measures physical disk capacity usage (large files consume space)
  • df -i: Tracks inode consumption (numerous small files exhaust inodes)

Inode metadata includes:

  • File pemrissions
  • Ownership
  • Timestamps
  • Pointer to data blocks

Both full disk and full inode scenarios typically require file deletion, but target different types:

  • df -h: Remove large files freeing space
  • df -i: Eliminate numerous small files freeing inodes

Tags: Linux filesystem Inode disk-space troubleshooting

Posted on Tue, 27 Oct 2026 16:18:35 +0000 by reidme