Rain Wiki · Linux

Inodes and 'No space left on device'

What an inode is, how to see inode usage with df -i, and how to find directories with millions of small files.

Linux · Rain Wiki

An inode is the data structure a Unix-style file system uses to store information about a file, such as its owner, permissions, size and where its data lives. Each file uses one inode, and many file systems have a fixed number, so millions of tiny files can cause 'No space left on device' while df -h still shows free space.

How to see it

'df -i' lists total, used and free inodes per file system. 'ls -i' shows a file's inode number, and 'stat <file>' shows its inode details.

Typical causes

Session or cache directories of web applications, mail queues, unrotated small log files and build caches can create millions of files.

Finding the directory

GNU du can count inodes: 'du --inodes -x / | sort -n | tail' lists the directories with the most entries.

How to fix inode exhaustion

  1. Confirm: df -i (IUse% near 100%).
  2. Find the directory: sudo du --inodes -x --max-depth=3 / | sort -n | tail -20
  3. Check what creates the files before deleting anything.
  4. Remove old files of that application with its own tool, or with find, for example: find /path -type f -mtime +7 -delete after a dry run without -delete.

Cautions

  • Always run find without -delete first and read the list.
  • The inode count of ext4 is fixed when the file system is created.

Sources

Last updated: 2026-10-08

Related articles