Common Issues
Disk Full
What to do when server disk is full and how to free up space quickly
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 -hIf 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 -20Enter the largest folder and analyze
du -h /var --max-depth=2 2>/dev/null | sort -rh | head -10Find the largest files
find / -type f -size +100M 2>/dev/null | xargs ls -lh | sort -k5 -rhAreas 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/nginx3. Cache and packages
# Debian/Ubuntu
apt clean
apt autoremove -y
# CentOS
dnf clean all4. /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 pruneEmergency 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" -deletePrevention: configure logrotate
Make sure automatic log rotation is active:
# Check service
systemctl status logrotate
# Force manual rotation
logrotate -f /etc/logrotate.confExhausted inodes
Sometimes df -h shows available space but disk is still "full". Check inodes:
df -iIf 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 -10Common causes: PHP sessions in /tmp, web cache files, email in spooler.
See the full guide: Disk Management