Disk Full
Full disk is one of the most frequent causes of malfunctions: sites not working, databases stop writing, error logs filling up. Here's how to fix it.
Quick check
df -h
If a line shows 100% or close, that partition is full. The main partition is usually mounted on /.
Find what's taking space
Largest folders in root
du -h / --max-depth=2 2>/dev/null | sort -rh | head -20
Enter the largest folder and analyze
du -h /var --max-depth=2 2>/dev/null | sort -rh | head -10
Find the largest files
find / -type f -size +100M 2>/dev/null | xargs ls -lh | sort -k5 -rh
Areas that fill up most often
1. System logs
# Check log size
du -sh /var/log/
# Delete old logs (older than 7 days)
journalctl --vacuum-time=7d
# Limit logs to max 500MB
journalctl --vacuum-size=500M
# See largest logs
ls -lhS /var/log/
2. Nginx / Apache logs
# Check size
du -sh /var/log/nginx/
du -sh /var/log/apache2/
# Empty a log (without deleting it)
> /var/log/nginx/access.log
# Configure automatic rotation
cat /etc/logrotate.d/nginx
3. Cache and packages
# Debian/Ubuntu
apt clean
apt autoremove -y
# CentOS
dnf clean all
4. /tmp files
du -sh /tmp/
rm -rf /tmp/*
5. MySQL logs
du -sh /var/log/mysql/
# MySQL binary logs (can become huge)
ls -lh /var/lib/mysql/mysql-bin.*
# In MySQL, purge old binary logs
mysql -u root -p -e "PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY);"
6. Unused Docker images
# If you use Docker
docker system prune -a
docker volume prune
Emergency free space (quick)
# Combined quick cleanup
apt clean && apt autoremove -y
journalctl --vacuum-size=200M
rm -rf /tmp/*
find /var/log -name "*.gz" -delete
find /var/log -name "*.old" -delete
Prevention: configure logrotate
Make sure automatic log rotation is active:
# Check service
systemctl status logrotate
# Force manual rotation
logrotate -f /etc/logrotate.conf
Exhausted inodes
Sometimes df -h shows available space but disk is still "full". Check inodes:
df -i
If a partition is at 100% inode, find the folder with too many small files:
find / -xdev -printf '%h\n' 2>/dev/null | sort | uniq -c | sort -rn | head -10
Common causes: PHP sessions in /tmp, web cache files, email in spooler.
See the full guide: Disk Management
Related articles
Locked Out of VPS
Complete guide to recover server access when locked out, with step-by-step instructions from VNC Console
Server Unreachable
What to do when server is not responding or you can't connect via SSH
Website Not Reachable
What to do when website is not responding, shows errors, or is unreachable
