"Disk full" when there is space left: the four real causes

Used space does not match the sum of the files, or writes fail on a half-empty disk. Deleted files still held open, exhausted inodes, reserved blocks, a mount hiding data: the diagnosis, in order.

The service refuses to write, the system says the disk is full. You look: 60% used. You delete the biggest log file you can find, and nothing moves.

Four causes cover almost every one of these situations. Taken in order, they take a few minutes to diagnose.

1. The deleted file that still occupies space

By far the most frequent cause, and the most counter-intuitive.

On Linux, deleting a file only removes its directory entry. The blocks are freed only once the last open descriptor on that file is closed.

The scenario is a classic: a service writes to a log that has grown out of all proportion. You delete it to make room. The service keeps its descriptor open — and cheerfully goes on writing into a now-invisible file, which goes on growing.

The signature is unmistakable: the usage tool reports a full disk, while walking the directory tree turns up nothing that justifies it. The gap matches exactly what was deleted without being closed.

The fix: identify the processes holding deleted files, then restart them or ask them to reopen their logs. And going forward, set up log rotation rather than deleting by hand — rotation tells the service, deletion does not.

The reflex that saves time: if the usage figure and the directory walk disagree, look for deleted-but-still-open files before any other hypothesis.

2. Exhausted inodes

Here the disk genuinely is not full — something else is.

Every file consumes an inode, which stores its metadata. Their count is fixed when the filesystem is created and cannot be increased afterwards.

A system that accumulates millions of small files — application caches, web sessions, mail, queues — can exhaust that table while disk space remains plentiful.

The error message still talks about insufficient space, which sends you down the wrong path. Checking inode usage settles it: if it is at 100% while space is not, you have your answer.

The remedy is deleting the small files you do not need — often a forgotten cache directory. If the problem is structural, you have to recreate the filesystem with a higher inode density, or pick a filesystem that allocates them dynamically.

3. The blocks reserved for root

By default, ext4 reserves 5% of the blocks for the root user. An ordinary user therefore sees a full disk while space remains — space they are not allowed to use.

That reserve has two sound justifications: letting a system service still write when the disk fills up, and limiting fragmentation by avoiding a completely full filesystem.

On a system partition it is useful. On a multi-terabyte data volume, 5% means tens of gigabytes tied up for no real benefit.

The reserve can be adjusted live, without unmounting the volume. Bring it down to 1% or to zero on a pure data volume; leave it in place on the root partition.

4. The mount that hides files

Rarer, but thoroughly disorienting when it happens.

You write data into a directory. Later, you mount a disk on that same directory. The original files become invisible — the mount covers them — but they still occupy space on the underlying volume.

The typical scenario: a data directory filled for weeks before the disk meant for it was finally mounted. Tens of gigabytes vanish from view while still being counted.

To find them again, mount the root of the volume somewhere else and inspect the hidden path. The files are there, intact, simply covered up.

The false gaps

Two mechanisms produce legitimate differences between the stated size of files and the space actually consumed.

Sparse files declare a large size but only occupy the regions actually written: common for virtual machine disk images. They take up less than they advertise.

Snapshots do the opposite: they hold on to blocks that appear in no current file. The space is consumed, and no visible file accounts for it. On a system that handles snapshots, that is always the first thing to check.

The diagnostic order

  1. Compare the usage the system reports against the real sum of the directories. A gap points straight at deleted-but-open files or at snapshots.
  2. Check the inodes: it is instant, and it rules the second cause in or out.
  3. Hunt for deleted files still held open, and restart the processes involved.
  4. Check the mounts and inspect any directory that might have been filled before it was mounted over.

And run the analysis with the privileges it needs: a tool that is not allowed to read a directory skips it silently, and you end up hunting for missing space that was simply out of reach of the measurement.

Frequently asked questions

I deleted a huge log file, why did the space not come back?
Because a process still holds it open. On Linux, deleting a file removes its directory entry, but the blocks are only freed once the last descriptor is closed. A service writing to that log keeps it open: it even carries on writing to it, into a file that has become invisible. You either restart the service or ask it to reopen its files. This is the number one reason space does not come back after a deletion.
What is an inode, and how can you run out of them?
An inode stores a file's metadata — permissions, timestamps, where its blocks live. Their number is fixed when the filesystem is created and cannot be increased afterwards. Every file consumes one, whatever its size. Millions of small files — caches, sessions, mail — can therefore exhaust the table while the disk is half empty. The symptom is confusing: the write fails for lack of space, but the space is right there.
Why do 5% of the disk look unreachable?
Because ext4 reserves 5% of the blocks for the root user by default. The purpose is twofold: guaranteeing that a system service can still write if the disk fills up, and limiting fragmentation. On a system partition, that is useful protection. On a multi-terabyte data volume it means tens of gigabytes tied up for nothing — that reserve can be reduced, or dropped to zero, on a volume that hosts no critical service.
What is a mount that hides data?
If you write files into a directory and then mount a disk on that same directory, the original files become invisible: the mount covers them. They nonetheless carry on occupying space on the underlying volume. The classic case is a data directory that got filled before the disk meant for it was mounted. To find them again, you have to mount the root of the volume somewhere else and inspect the hidden path.
Why does the sum of the files not match the used space?
Several mechanisms can explain the gap. Deleted-but-still-open files are one of them. Sparse files — whose empty regions are never actually written — occupy less than their stated size. Conversely, snapshots hold on to blocks that appear in no current file. And measurement tools silently skip whatever they are not allowed to read: always run the analysis with the privileges it needs.

Did you enjoy this article?

Comments

Morgann Riu

Cybersecurity and Linux administration expert. I help companies secure and optimize their critical infrastructures.

Back to the blog

Checklist Sécurité Linux

30 points essentiels pour sécuriser un serveur Linux. Recevez aussi les nouveaux tutoriels par email.

Pas de spam. Désabonnement en 1 clic.