Fundamentals 5 min read

Why Inodes Fill Up Even When Disk Space Is Free—and How to Fix It

This article explains what inodes are, why they can become exhausted despite available disk space, and provides practical Linux commands and preventive steps to identify and resolve inode exhaustion issues.

Open Source Linux
Open Source Linux
Open Source Linux
Why Inodes Fill Up Even When Disk Space Is Free—and How to Fix It

1. Introduction to inodes

In Linux, file data is stored in blocks, while metadata such as owner, timestamps, and size are stored in an inode (index node). The inode area occupies disk space; during formatting the disk is split into a data area and an inode table.

Each inode is typically 128 or 256 bytes. The total number of inodes is set at format time, often one inode per 1 KB or 2 KB. For a 1 GB disk with 128‑byte inodes and one inode per 1 KB, the inode table would be about 128 MB, i.e., 12.8 % of the disk.

2. Inode exhaustion

When all inodes are used, new files cannot be created even if free space remains, which commonly occurs when many small files fill the inode table.

Disk space may still be available because only a few percent of inodes are typically consumed, so inode usage is often overlooked.

Example commands: df to view disk usage and df -i to view inode usage. In the shown screenshot, disk space is at 71 % while inodes are at 100 %.

3. Resolving inode exhaustion

The size and number of inodes are determined when the filesystem is formatted; larger partitions allocate more inodes.

Root partitions are usually small, so frequent creation of tiny files can quickly fill inodes.

Steps to free inodes:

(1) Identify directories with the most files for i in /*; do echo $i; find $i | wc -l; done In the example, /var/spool/postfix/maildrop contained many small files because cron output was being mailed to a non‑functional sendmail/postfix, causing accumulation.

Another issue was a per‑minute cron job that created a temporary file.

(2) Delete the excess files

ls | xargs -n 1000 rm -rf

4. Preventive measures

(1) Suppress cron mail by adding MAILTO="" to crontab -e.

(2) Redirect cron output to /dev/null when logs are not needed: */10 * * * * /tmp/test.sh > /dev/null 2>&1 (3) Periodically clean old files, e.g.:

find /path/to/dir -type f -mtime +30 | xargs -n 1000 rm -f

(4) Monitor inode usage regularly.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxFilesystemdisk spaceinodes
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.