Quick answer: df -h shows how full each filesystem is; du -sh /var/* 2>/dev/null | sort -h shows what's eating space; ncdu / gives an interactive browser. Keep at least 10–15% free — a 100% full disk breaks databases and even SSH logins.
Overview
Disk usage grows silently: logs, caches, old backups, docker images. Checking takes seconds and prevents the classic "everything stopped working" incident caused by a full root filesystem.
Before you start
- SSH access.
- Optionally install ncdu:
apt install -y ncdu # Ubuntu / Debian dnf install -y ncdu # AlmaLinux / Rocky
Step-by-step guide
- Overall usage:
Look at thedf -h/line (and/var,/homeif separate). - Find the heavy directories:
du -xh / --max-depth=2 2>/dev/null | sort -h | tail -20 - Interactive exploration:
Navigate with arrows, delete carefully with d.ncdu -x / - Usual suspects:
Trim the systemd journal:journalctl --disk-usage du -sh /var/log /var/cache /tmp docker system df # if you use Dockerjournalctl --vacuum-size=200M; clean apt cache:apt clean; prune docker:docker system prune. - Watch inodes too — millions of tiny files can exhaust them while df shows free space:
df -i
Common issues
- Deleted a huge file but space didn't return? A process still holds it open — find it with
lsof +L1and restart that service. - df and du disagree? Same cause as above, or data hidden under a mount point.
- Disk genuinely too small? Upgrade the disk — Storage VPS plans offer large volumes at low cost.
When to contact support
If the disk is 100% full and the server misbehaves badly (can't log in, database down), see the out-of-disk emergency guide or open a support ticket.
Frequently asked questions
How much free space should I keep?
Keep at least 10-15% of the disk free at all times. A filesystem that hits 100% breaks databases, stops logging and can even prevent SSH logins, so act well before you reach that point.
I deleted files but space did not come back — why?
A running process still holds the deleted files open, so the kernel cannot release their blocks yet. Find the holder with lsof +L1 and restart that service to reclaim the space.
What fills the disk most often?
Logs (/var/log, journald), package caches, old backups and Docker images. journalctl --vacuum-size and docker system prune reclaim a lot.
Related articles
- How to expand disk space after upgrade
- How to upgrade VPS resources
- How to check VPS CPU, RAM and disk usage
- Server is out of disk space
Need a hand? Contact Cloud2Y support →
