Disk Full on a Linux Server: How to Find What's Eating Space
"No space left on device" can take a server down. Here's how to quickly find the culprit and reclaim space safely.
A server throws No space left on device and suddenly things break — apps can't write, logs stop, deploys fail. A full disk is an emergency, but tracking down the cause is quick once you know the two or three commands that matter.
Step 1: Confirm the disk is actually full
df -h
This lists each filesystem with its size and how full it is. Find the one at or near 100% — that's the one you need to clear. (df reporting full while files seem small can also mean inodes are exhausted, but a genuinely full disk is the common case.)
Step 2: Find the biggest directories
Starting from the full filesystem (often /), find what's hogging space:
du -h --max-depth=1 / | sort -h
That shows the size of each top-level directory, largest last. Follow the trail downward into the biggest one, repeating the command, until you find the actual culprit.
The usual suspects
- Log files — runaway logs in
/var/logare the classic cause, sometimes a single huge file. - Old container images and volumes — Docker can quietly eat enormous space over time.
- Build artifacts, caches, and old releases piling up from repeated deploys.
- Forgotten backups or dumps left in a home directory.
Step 3: Reclaim space safely
Delete with care — confirm what something is before removing it. Truncating or rotating a giant log is usually safe; if Docker is the offender, its built-in cleanup reclaims unused data:
docker system df # see what Docker is using
docker system prune # remove unused data (read the prompt first)
Never blindly delete files you don't recognise to free space — you can break the system worse than a full disk. Identify first, then remove.
The takeaway
df -h to find the full filesystem, du to walk down to the biggest offender, then clear it deliberately. Logs and Docker leftovers are the usual villains, and a few minutes with these commands turns a scary outage into a routine cleanup.
Stop reading, start building
This pairs with a hands-on BytExplorer course — do it on your own machine and actually keep the skill.