Linux no free disk space alert

If your Linux system is warning you that there's no free disk space even though df or similar tools show that there is disk space free, there are a few possible explanations. Here's how to diagnose and fix the issue.

Open a terminal and run:

df -h

Look for the root (/) partition. You might see something like:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G   42G  8.0G  84% /

So in this case, 16% free (8.0G available) — seems okay at first glance. But that doesn't always tell the whole story.

Step 1: Check inode usage

Linux filesystems also have inodes, which track metadata for files. If you run out of inodes, you can’t create new files even if you have disk space.

Run:

df -i

If the IUse% is 100% for any mounted filesystem, you’ve run out of inodes. This usually happens if you have tons of tiny files, e.g. in /tmp, /var, or cache directories.

Step 2: Check what’s using up space

You can check which directories are using up the most space:

sudo du -hxd1 / | sort -hr | head -20

Look for heavy directories like /var, /tmp, /home, or /snap.

Step 3: List the directories that use the most inodes from /home partition

find /home -xdev -type f | cut -d/ -f1-4 | sort | uniq -c | sort -nr | head

What it does:

  • find / -xdev -printf '%h\n' — prints the directory (parent path) of each file (inode).
  • sort | uniq -c — counts how many times each directory appears (i.e., how many files are in each).
  • sort -nr — sorts numerically, descending.
  • head -20 — shows the top 20 directories by inode usage.
  • -xdev prevents crossing into other mounted filesystems (like /proc, /mnt, /media).

Check inode usage per top-level directories

This is another handy command to check top-level inode usage in /:

for i in /*; do echo "$i: $(find "$i" -xdev -type f | wc -l) files"; done | sort -k2 -nr | head

This tells you roughly how many files (inodes) exist in each major directory.

Step 4: Check for orphaned deleted files still open

Sometimes, log files or temp files are deleted but still open by a running process — they still take up space.

Check with:

sudo lsof | grep deleted

If you see big files still held open, find the process ID and restart it:

sudo systemctl restart <service-name>

Or kill the PID:

sudo kill -9 <PID>