Recover from a full disk
Updated 27 Nov 2026 disk
Free space safely when services fail because the filesystem is full.
Confirm
df -h
df -i
Free a little space first
sudo journalctl --vacuum-size=100M
sudo apt clean
Find the cause
sudo du -xh --max-depth=2 /var 2>/dev/null | sort -h | tail -15
sudo lsof +L1
Typical causes
- A log growing without rotation: empty it with
sudo truncate -s 0 /var/log/app/huge.log, then set up rotation. - Docker images and logs:
docker system prune(read what it will remove; add volumes only if you are sure). - Old backups kept on the server.
- A deleted file still held open: restart that program.
Then
systemctl --failed
sudo systemctl restart postgresql # or whichever service failed
Check databases carefully for errors before accepting new writes.
Prevent it
Watch usage and act at 80%. If you truly need more, upgrade or add storage. Disks cannot shrink later.