The disk hit 100 percent overnight, half your services are refusing to start, and nothing was deployed. The cause is almost never mysterious — it is one of four things quietly writing until there was no room left.
A full root filesystem is one of the most common ways a Linux server falls over, and one of the most avoidable. Logins hang, databases go read-only, the container runtime throws write errors, and df -h shows / at 100 percent. The frustrating part is that usually nothing changed — the same workload that ran fine for months simply crossed a line, because something was accumulating with no cap on it. This is the diagnosis I run, in order, on Ubuntu 24.04, and the settings I put in afterwards so the same night does not repeat.
First, confirm it is space and not inodes
Before hunting for a big directory, rule out the second failure mode. A filesystem can report space free and still refuse writes because it has run out of inodes — millions of tiny files, typically from a mail queue, a session store, or a broken cache. Check both:
df -h / # space used
df -i / # inodes used
If df -i shows IUse% at 100 while df -h has room, you have an inode problem, not a space problem, and the hunt is for a directory with a vast number of small files rather than a few large ones. Most of the time, though, it is genuinely space — so find the growth.
Find the growth with du and ncdu
Start at the top of the tree and work down. The -x flag keeps du on a single filesystem, so it will not wander off into a mounted data volume and confuse the picture:
# One screen of the biggest top-level directories on /
sudo du -h -d1 -x / 2>/dev/null | sort -h | tail -20
# Interactive, and far faster to walk a large tree
sudo ncdu -x /
ncdu is worth the thirty seconds it takes to install (apt install ncdu) — it gives you a navigable, sorted view of where the bytes are, and you can delete from inside it. It is a system package, so apt is the right route here rather than the approach I use for Python-based CLI tools. In practice the offender is almost always somewhere under /var — either /var/log or /var/lib/docker. That narrows it to the usual suspects.
The journal that blew past its cap
By default, systemd-journald caps itself at 10 percent of the filesystem, up to a maximum of 4 GB. On a small VPS with a 20 GB root disk, that 10 percent is only 2 GB — but if something is logging aggressively, or persistent storage was enabled without a tighter cap, the journal can still be a meaningful chunk of a nearly full disk. Check it, then vacuum:
journalctl --disk-usage # how big is the journal now
sudo journalctl --vacuum-size=200M # keep at most 200 MB
sudo journalctl --vacuum-time=7d # or drop anything older than 7 days
Vacuuming reclaims space immediately. To make the cap permanent, set SystemMaxUse in /etc/systemd/journald.conf — for example SystemMaxUse=500M — and run systemctl restart systemd-journald. Now the journal can never be the thing that fills the disk.
Unbounded Docker container logs
This is the one that catches most people. Docker’s default logging driver is json-file, and out of the box it applies no size limit and keeps a single file per container. A chatty application — one dumping stack traces, health-check noise or debug output — will write to /var/lib/docker/containers/<id>/<id>-json.log until the disk is gone. Find the culprits:
sudo du -h -d1 /var/lib/docker/containers | sort -h | tail
The fix is a global default in /etc/docker/daemon.json, so every container inherits rotation whether or not the compose file remembered to set it:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
Run systemctl restart docker to apply it. One caveat that trips people up: this only takes effect for containers created after the change. Existing containers keep their old logging config until you recreate them (docker compose up -d --force-recreate, or remove and re-run). Until then, you can truncate a runaway log in place with truncate -s 0 <path> rather than deleting it, which the running process may still hold open.
The deleted file that still holds the space
Here is the case that makes people doubt their tools. You find the huge log, you rm it, and df still shows the disk full — but du can no longer find the space. On Linux, deleting a file only removes its directory entry. If a process still has the file open, the inode and its blocks are not freed until that process closes the handle or exits. The space is held hostage by a running program writing to a file that no longer has a name.
lsof reveals it. The +L1 filter lists open files whose link count is below one — precisely the deleted-but-open case:
sudo lsof +L1
The output shows the process, its PID, and the size of the phantom file. To reclaim the space cleanly, restart that process (or the service that owns it). If you cannot restart it immediately, you can empty the file through its open descriptor without killing anything: : > /proc/<PID>/fd/<FD>. This is exactly why truncating is safer than deleting an active log file in the first place.
Stopping the 3 a.m. repeat
Reclaiming space is the easy half. The point is not to be back here next month. Three caps and one alert cover almost every case: a SystemMaxUse ceiling on journald, a global log-opts block in daemon.json for Docker, and a logrotate rule for any application log that writes outside the journal — most applications that log to a bare file under /var/log or an app directory have no rotation at all unless you give them one. Then set a monitor that pages when / crosses 80 percent, so you find out with headroom to act rather than after the writes have already failed.
A disk that fills overnight is rarely a capacity problem; it is a governance problem wearing a capacity costume. Something was allowed to grow without a limit. The same discipline applies to memory pressure and the quieter surprise of running a server out of swap. Put the caps in before the incident, and the 3 a.m. page never comes.
Build and rescue work
Hands-on delivery of this kind is handled by Sixteen Pillars Studio.
Free interactive tool
Website compliance checklist
What your site has to do, based on what it actually does
Answer as much or as little as you like — the list builds as you go. Nothing is stored against your name and no email is required.
Everything that applies
Ordered by what to do first: legal requirements you can close quickly, then larger pieces of work, then what is expected rather than required. Not exhaustive, and not a legal audit.
Dated PDF, yours to keep or circulate.
Most technology problems are not technology problems. They are control problems.
The systems exist. The investment has been made. The question is whether leadership can understand, direct, evidence, and sustain what those systems produce. Find out where control exists — and where it only appears to.