- Checked
- 2026-11-14
No space left on device. Find what filled the disk.
A full disk is the most common outage on a small server, and it looks like everything else: the database stops, uploads fail, pages show errors, sometimes even an SSH login hangs. Find out what filled it before you delete anything.
Confirm it
df -h shows each filesystem and how full it is. 100 percent on /, or on the one that holds /var, is your answer.
If df shows free space and you still get the error, run df -i. A filesystem can run out of inodes, the slots for files, when something writes millions of small files: sessions, cache entries, mail stuck in a queue.
Find what filled it
du -xh --max-depth=1 / | sort -hlists each top-level folder on that filesystem by size, biggest last. Repeat inside the biggest one until you reach the cause.journalctl --disk-usageshows how much the system journal takes.find / -xdev -type f -size +500Mlists single big files: old backups, database dumps, core dumps, video uploads.- lsof +L1 lists files that were deleted but are still held open by a process. Their space comes back only when that process closes them or restarts.
docker system df, on a server that runs Docker, shows the space taken by images, containers and volumes.
Freeing space without breaking anything
- Logs:
journalctl --vacuum-size=500Mtrims the journal. For a huge log a service still writes to,truncate -s 0empties the file in place;rmwould leave the space held until the service restarts. - Packages:
apt-get cleandrops the cache of downloaded packages.apt autoremoveremoves old kernels and packages nothing needs; read the list before you say yes. - Old backups and dumps on the same disk: move them off the server. A backup on the disk it is meant to protect does not protect it.
- Docker:
docker image pruneremoves unused images.docker system prunegoes further, and with--volumesit deletes data, so read what it lists before you confirm.
Afterwards
Restart what stopped while the disk was full: systemctl --failed lists it, and the database is often there.
Then find out why it filled: a log with no rotation, a backup job that never deletes old copies, a debug setting left on, a cache that only grows. Check that logrotate covers the app's own logs, set SystemMaxUse= in /etc/systemd/journald.conf, and have something warn you when the disk passes 80 percent.
What not to do
- Do not delete anything under
/var/lib/mysqlor/var/lib/postgresql. Those big files with odd names are the database. - Do not delete a MySQL binary log by hand.
PURGE BINARY LOGSin the mysql client removes old ones safely. - Do not run
rm -rfwith a wildcard or a variable you have not printed withechofirst.
When to stop and hand it over
Stop if the space is taken by the database itself, if the database will not start now that the disk has room, or if you cannot tell what a big folder is for. Our Server Rescue is one incident at a fixed $69, with a same-day start listed at $109, and nothing to pay if we cannot fix it. Nothing gets deleted that we have not identified first.
Questions people ask
- What fills a server's disk most often?
- Logs that are never rotated, backups kept on the same disk, and on Docker hosts old images.
dushows which in a minute. - I deleted files and
dfstill says the disk is full. Why? - A running process still holds them open.
lsof +L1lists them, and restarting that service gives the space back. - Can a full disk damage the database?
- It can stop it in the middle of a write. MySQL, MariaDB and PostgreSQL recover on restart in most cases, but read the database's log after it starts and take a backup before anything else.
- What does fixing a full disk cost?
- With us, Server Rescue at $69 for the incident, or $109 for a same-day start. If we cannot fix it, you pay nothing.
Where each statement comes from
Checked against the sources on .
- df(1) manual page (man7.org)
- du(1) manual page (man7.org)
- systemd: journalctl (freedesktop.org)
- systemd: journald.conf (freedesktop.org)
- Docker: docker system prune (docs.docker.com)
- MySQL: PURGE BINARY LOGS (dev.mysql.com)
More server help
- Server down: what to check first
- Error establishing a database connection
- 504 Gateway Timeout
- Linux server hardening checklist
- 502 Bad Gateway on nginx
- WordPress white screen or critical error
- Too many redirects
- 403 Forbidden on nginx or Apache
- SSL certificate expired: the fix
- Renewing a Let's Encrypt certificate
- DNS not resolving or still on the old server
- Email from the server going to spam
- Website hacked: the first steps
- Moving a site to a new server
- All server help guides
