My disk is full (and it took my website or database down)
What this is
A full disk almost never says "disk full". It says something else:
- your website is suddenly offline, throwing 500 errors or blank pages,
- MySQL/MariaDB won't start, crashes, or goes read-only, logs show
Disk full (errno 28)orNo space left on device, - your app crashes whenever it writes (uploads, sessions, caches, queues),
- cron jobs, updates, even logins misbehave in strange ways.
If a service died "for no reason", check the disk before anything else. It's a ten-second test and one of the most common hidden causes of "my site/app/database is down":
df -h
If a filesystem (usually /) shows 100% (or 99%), you've found it. And if df -h shows plenty free yet writes still fail with "No space left on device", check df -i: you're likely out of inodes instead, millions of tiny files rather than big ones, which has its own guide.
Find what's eating the space
Work down from the root, largest first:
du -xhd1 / | sort -h
Then re-run it on the biggest directory (du -xhd1 /var | sort -h, and so on) until you find the culprit. If you'd rather browse interactively, apt install ncdu and run ncdu -x /.
The usual suspects, and how to clean each safely:
- systemd journal logs. Check with
journalctl --disk-usage; shrink withjournalctl --vacuum-size=200M, and cap it permanently withSystemMaxUse=200Min/etc/systemd/journald.conf. - Application and web-server logs in
/var/log. An app stuck in an error loop can write gigabytes overnight. Empty a huge live log with: > /var/log/thefile.log(truncation) rather than deleting it, a deleted file that a running service still holds open keeps occupying space until the service restarts. (Find those ghosts withlsof +L1.) - Docker. Check with
docker system df. Old images, stopped containers, unused volumes, and unbounded container logs add up fast.docker system pruneclears the safe stuff; add-ato also drop unused images (they'll re-download on next use). Cap container logs going forward with log rotation in/etc/docker/daemon.json. - Package caches:
apt clean(ordnf clean all). - Old dumps and backups parked in
/var/backups,/root, or your home directory, ship them off-site instead of hoarding them on the disk they're supposed to protect.
What NOT to do
- Don't delete things you can't identify, especially anything under
/var/lib(that's where your databases live,/var/lib/mysqlis your data, not clutter),/usr, or/etc. Freeing space by deleting the wrong file turns an outage into data loss. - Don't bulk-delete in
/tmpon a live system without looking, running services may be mid-write there. - Not sure what something is? Ask us, or ask an AI chatbot with the exact path, before removing it.
After you've freed space
Restart whatever fell over, databases especially don't recover from a full disk until restarted:
systemctl restart mariadb # or mysql, postgresql, nginx, your app...
systemctl status mariadb
Then load your site and confirm. If MySQL/MariaDB won't come back cleanly after an errno-28 incident, stop, don't experiment against your only copy of the data, follow the safe recovery order, and open a ticket with the exact log lines if it doesn't recover.
Keep it from happening again
- Log rotation is your friend: logrotate handles
/var/logby default, but confirm your app's own logs are covered, and cap journald and Docker logs as above. - Glance at the disk graph on your VPS's Graphs tab now and then, disk usage grows slowly and visibly; catching it at 85% is painless.
- Genuinely need more room? Additional Storage adds disk without changing your plan, or upgrade if everything is getting tight.
Related questions
- "My website suddenly went down, could the disk be full?"
- "MySQL won't start and says disk full (errno 28), what do I do?"
- "How do I find what's using all my disk space?"
- "Is it safe to delete Docker images or journal logs?"
- "Why does it say no space left when the disk isn't full (inodes)?"
- "How do I add more disk space to my VPS?"