A full disk is one of the most common causes of server emergencies. When a Linux server disk fills to 100%, MySQL stops writing to databases, PHP cannot create temporary files, email bounces, and logs cannot be written. Your sites go down silently with no obvious error message to the visitor.
Here is how to diagnose and fix it quickly.
Check Disk Usage First
Run df -h on your server. If any partition shows 90%+ used, you need to act now. 100% means some services are already failing.
Step 1: Find What Is Using the Space
Run these commands in order to find the large files:
# Find largest directories
du -sh /* 2>/dev/null | sort -hr | head -15
# Drill into the largest one (e.g. /var)
du -sh /var/* 2>/dev/null | sort -hr | head -15
# Find individual large files
find / -type f -size +100M 2>/dev/null | sort -k5 -rn | head -20
The 6 Most Common Causes
1. Log Files That Were Never Rotated
The most common cause. Nginx, Apache, MySQL, and PHP error logs grow indefinitely without log rotation configured. A single busy site can generate gigabytes of access logs per month.
Fix:
# Check log sizes
du -sh /var/log/* | sort -hr | head -10
# Clear a specific log safely (do NOT delete it)
truncate -s 0 /var/log/nginx/access.log
# Restart nginx to re-open log file
systemctl restart nginx
Prevent recurrence: Configure logrotate. Check /etc/logrotate.d/ — most services have a config here. If missing, create one.
2. Old Backup Files Accumulating
aaPanel and cPanel backup tasks create files in /www/backup or /home/*/backup. If retention is set to "keep all" they grow indefinitely.
Fix: Go to aaPanel → Cron → edit your backup tasks → set retention to 7 days. Then manually delete old backup files from the backup directory.
3. MySQL Binary Logs
MySQL binary logs (used for replication and recovery) accumulate rapidly on busy databases. They live in /var/lib/mysql/ as files named mysql-bin.000001, etc.
# Check binary log size
du -sh /var/lib/mysql/mysql-bin* 2>/dev/null
# Purge logs older than 7 days (run in MySQL)
mysql -u root -p -e "PURGE BINARY LOGS BEFORE DATE_SUB(NOW(), INTERVAL 7 DAY);"
# Disable binary logs if not needed (add to /etc/mysql/my.cnf)
# skip-log-bin
4. PHP Session Files
PHP stores session files in /tmp or /var/lib/php/sessions. On a busy site with no session cleanup, millions of small files accumulate.
find /var/lib/php/sessions -type f -mtime +7 -delete
5. WordPress Upload Bloat
Unoptimised media uploads, multiple image sizes generated by WordPress, and plugin-generated files accumulate in wp-content/uploads. A single high-traffic blog can generate 10-20GB over a few years.
Fix: Audit /wp-content/uploads for very large files, remove duplicates, and implement a media cleanup plugin. Consider offloading media to cloud storage (S3, Cloudflare R2).
6. Core Dumps
When processes crash, Linux can write large core dump files. Check /var/crash or /tmp for files ending in .core or core.*
find / -name "core.*" -o -name "*.core" 2>/dev/null | xargs ls -lh 2>/dev/null
Setting Up Disk Monitoring
Never find out about a full disk from a down site. Set up an alert:
# Add to crontab — alert when disk over 80%
*/30 * * * * /usr/local/bin/check-disk.sh
Alternatively, aaPanel has built-in monitoring alerts under Monitor → Disk Usage — configure email alerts at 80% threshold.
Related Reading
- 5 Signs Your Server Needs Immediate Attention — disk space is sign #2
- How to Set Up aaPanel on a VPS — set up backup retention properly from the start
Server Disk Full? Need Emergency Help?
NextCode Solutions provides same-day emergency server support. We diagnose, clean, and prevent recurrence.
Get Emergency Help