June 9, 2026 · 5 min read
Linux VPS disk full — how to find and free space safely
When disk is full, services crash and deploys fail. Use df and du to find large directories, clean logs and caches carefully, and avoid deleting system paths blindly.
A full disk on a Linux VPS causes 502 errors, failed deploys, and database corruption. Free space in this order: confirm usage, find the largest directories, clean safely, then fix what is growing unbounded.
Step 1: Confirm the problem
df -h
df -i
If Use% is 100% on / or /var, or IUse% is 100%, you have a disk or inode emergency.
Step 2: Find what grew
sudo du -xh --max-depth=1 /var 2>/dev/null | sort -h | tail -10
sudo du -xh --max-depth=1 /home 2>/dev/null | sort -h | tail -10
Common culprits: /var/log, Docker (/var/lib/docker), old releases, application uploads, MySQL binlogs.
Step 3: Safe cleanup
| Target | Command / action |
|---|---|
| journald | sudo journalctl --vacuum-size=200M |
| apt cache | sudo apt clean |
| Old logs | sudo logrotate -f /etc/logrotate.conf or truncate specific huge logs |
| Docker (if unused images) | docker system df then docker image prune — not prune -a on prod without review |
| Old deploy artifacts | Remove known-old release folders your deploy tool no longer needs |
Step 4: Prevent repeat growth
- Log rotation for app logs
- Docker log limits in
daemon.json - Monitor disk at 80% alert threshold
- Separate
/varor data volume for databases if you outgrow the root disk
Read-only first
On production, run read-only checks (df, du, ls -lh) before any delete. If you use AI to help, insist on approval before rm, truncate, or docker prune.
Tools that help
Ohuriya AI is an AI DevOps Copilot for VPS owners—you can ask “find what is using disk” and approve each diagnostic or cleanup command before it runs. Connect your server · fix Nginx 502
Quick answers
How do I check disk space on a Linux VPS?
Run df -h for filesystem usage and df -i for inode exhaustion. Then du -xh --max-depth=1 /var or /home to find what grew.
Is it safe to delete /var/log files?
Rotate or truncate with logrotate—not rm -rf. For journald: sudo journalctl --vacuum-size=200M. Empty large logs only after confirming they are not needed for an active incident.
What should I never delete when disk is full?
Avoid rm -rf on /, /usr, /lib, or guessing at Docker overlay paths. Do not delete databases or volume mounts without knowing what they hold.