Skip to content
statance
MenuClose
← All troubleshooting guides

No space left on device, but the disk is not full

Linux

If df -h shows free space but writes fail with “No space left on device”, the filesystem has probably run out of inodes — every file uses one, regardless of size. Run df -i to confirm, then find the directory holding millions of small files, typically session files, cache entries, mail queues or build artifacts.

Symptoms

  • “No space left on device” while df -h shows free space
  • IUse% at 100% in df -i
  • Applications cannot create temp files or sessions

How to diagnose it

  1. Check inode usage

    IUse% at or near 100% confirms it.

    df -i
  2. Find directories with the most files

    Counts inodes per top-level directory on that filesystem (GNU du 8.22+).

    sudo du --inodes -x --max-depth=1 / 2>/dev/null | sort -rn | head
  3. Drill down

    Repeat on the largest directory until you find the one with the files.

    sudo du --inodes -x --max-depth=1 /var 2>/dev/null | sort -rn | head

Common causes and fixes

PHP session files never garbage-collected

Delete old session files and make sure session garbage collection or the distro cron job runs.

sudo find /var/lib/php/sessions -type f -mtime +2 -delete

Application cache with one file per entry

Clear the cache with the application’s own command, then move the cache to Redis or set an expiry.

Mail queue full of undeliverable messages

Inspect and clear the queue, then fix whatever sends the mail (often cron output).

mailq | tail -1 sudo postsuper -d ALL deferred

Old kernel headers or build artifacts

Remove unused kernels and packages; clear node_modules or build caches you no longer need.

sudo apt autoremove --purge

Prevent it happening again

  • Alert when INODES_used (fullest volume) is above 85%.
  • Add expiry to any process that creates one file per request or per cache entry.

Set it up: Linux monitoring.

FAQ

What is an inode?

A data structure that stores a file’s metadata. Most filesystems have a fixed number created when formatted, so many tiny files can use them all up.

Can I increase the number of inodes?

On ext4 only by reformatting with a different -i or -N value. XFS allocates inodes dynamically and rarely runs out.

Related guides

Get alerted before this becomes an outage.

Install the agent in one line. Statance watches CPU, memory, disk and services, and its AI assistant helps find the cause.