This guide shows you how to monitor vps disk usage before a full disk takes your site down. One day uploads work, the next day WordPress cannot write a session file, MySQL refuses new rows, and SSH logins start to fail. The fix is a routine: check usage, find what grew, and get an alert while you still have room to act.
A five-minute check once a week, plus an automatic alert at 80 percent, catches almost every slow fill before it becomes an outage.
Why a Full Disk Breaks More Than Uploads
Disk space feels like a storage problem until it hits zero. Then it becomes a database problem, a login problem, and a backup problem at the same time. MySQL and MariaDB need free space for temporary tables and binary logs. When they cannot write, queries fail and tables can be left in a bad state. WordPress needs space for uploads and cache files, while Nginx and PHP need space for logs and session files. Even a backup job can fail because it has nowhere to write the archive it was meant to save you with.
The other trap is speed. A disk can sit at 60 percent for months, then jump to 95 percent in a day from a runaway log file or a backup that copies itself into the folder it backs up. That is why a one-time cleanup does not solve the problem. You need a check that keeps running after you close the terminal.
If your database is the first thing to fail when space runs low, read our guide on how to monitor VPS disk space before it fills up and crashes MySQL as well. It covers the MySQL-specific warning signs, including binary logs and temporary tables, that a plain disk check can miss.
How to Monitor VPS Disk Usage With df and du
Start with df, the command that shows how much space each mounted filesystem has used and how much is left. Run it in a form you can read at a glance:
df -h
The -h flag prints sizes in GB and MB instead of blocks. Look at the Use% column for the filesystem mounted at /. If you have a separate mount for /var or /home, check those lines too, because a full /var can stop MySQL even when the root filesystem still has room.
To check vps disk space for one folder at a time, use du:
du -sh /var/* | sort -rh | head -20
This lists the largest folders under /var, biggest first. Swap in /home, /opt, or your web root when you need to look elsewhere.
For a live view of CPU, RAM, and disk together, see our walkthrough of how to monitor disk, RAM, and CPU usage on a VPS with htop and Glances, including which tool to pick on a small server with little RAM to spare.
Find What Is Eating Your Disk
Knowing the disk is 92 percent full does not tell you what to delete. The next step is to drill down one level at a time. Start at the top, find the biggest folder, then look inside it:
du -sh /* 2>/dev/null | sort -rh | head -10
du -sh /var/log/* 2>/dev/null | sort -rh | head -10
On a WordPress VPS, the usual suspects are log files, old backups stored on the same server, upload folders full of unused media, and cache folders that never get pruned. Docker owners have one more: images, stopped containers, and volumes that keep growing after the containers that made them are gone. If Docker is part of your stack, our guide on how to limit Docker container disk usage before it fills your VPS explains size limits and pruning in detail.
For an interactive view, install ncdu and run ncdu /var. Use the arrow keys to move into folders and press d to delete a file after you have checked what it is. Never delete a live database file, a running log that a service still holds open, or anything under a folder you do not recognise. When in doubt, move the file elsewhere first and delete it a week later, after the server has run fine without it.
Set Up VPS Disk Space Alerts With a Cron Script
Manual checks fail the week you get busy, so put the check on a schedule. A small shell script plus cron gives you vps disk space alerts without installing a full monitoring stack. The idea is simple: read the usage percentage, compare it with a threshold, and send a message when usage passes it.
Save this as /usr/local/bin/disk-alert.sh and make it executable with chmod +x:
#!/bin/bash
THRESHOLD=80
USAGE=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$USAGE" -ge "$THRESHOLD" ]; then
echo "Disk usage on $(hostname) is at ${USAGE}%. Check it now."
| mail -s "Disk alert: ${USAGE}% used on $(hostname)" [email protected]
fi
Replace [email protected] with an address you actually read, and make sure your server can send mail. If it cannot, swap the mail line for a Telegram bot call or a webhook. The alert must reach a place you check every day, not an inbox you open once a month.
Then add it to cron so it runs every hour: 0 * * * * /usr/local/bin/disk-alert.sh
Two thresholds work better than one. Alert at 80 percent, when you still have time to clean up calmly, and again at 90 percent, when you need to act the same day. If you want a fuller setup with Telegram or email delivery, our guide on how to set up disk space alerts on your VPS before it runs out walks through the options step by step.
Disk Usage Monitoring Tools Compared
A cron script is enough for one server. Once you run several servers, or you want graphs and history, a dedicated tool earns its place. The right choice depends on how many servers you run and how much RAM you can spare for monitoring.
| Tool | Best for | Setup effort | Alerts | Limitation |
|---|---|---|---|---|
| df + du + cron script | One VPS, low overhead | Low | Email or webhook, if you wire it up | No graphs or history |
| Netdata | Real-time graphs on one server | Low | Built-in alerts | Uses RAM and CPU on the server it watches |
| Prometheus + Grafana | Several servers, long history | High | Flexible rules and channels | Heavy for a 1-2 GB VPS |
| Uptime Kuma | Simple checks plus uptime | Low | Telegram, email, and more | Disk checks need extra setup |
These disk usage monitoring tools solve different problems, so pick by fit, not by feature count. A single WordPress VPS does well with a cron script plus Netdata for the occasional visual check. A small fleet does better with Prometheus and Grafana, where the monitoring load sits off the servers it watches. Keep the threshold the same either way: 80 percent to warn, 90 percent to act.
One warning applies to every tool here. Monitoring that lives only on the server it watches goes quiet when that server goes down. Send alerts somewhere else: your email, your phone, or a second server. An alert nobody receives is the same as no alert at all.
What to Do When Usage Hits 90 Percent
When the alert fires, work in order: stop the growth, free space safely, then find the cause. Check what grew with the du commands above, then free space from the safest places first: old compressed logs, package cache, and Docker images you no longer use.
sudo apt clean
sudo journalctl --vacuum-size=200M
docker system prune -a --volumes
Run the Docker command only if you know which images and volumes are safe to remove. Backups stored on the same disk are the next thing to move off the server, not delete. A backup that lives on the disk it backs up protects you from almost nothing.
After you free space, check the services that stopped writing while the disk was full. Restart MySQL or PHP-FPM only if they are actually in a bad state, and check the site in a browser before you call the job done. Then write down what filled the disk. If it was a log file, set up rotation. If it was a backup, move it off-site. If it was Docker, set a size limit.
Keep the Disk From Filling Again
Prevention is mostly rotation, retention, and separation. Rotate logs so they cannot grow without limit, keep only the backups you can actually restore from, and store those backups somewhere other than the server they protect. Delete old Docker images on a schedule instead of waiting for the disk to force the issue.
Set a monthly reminder to review the top ten folders, even if no alert has fired. Fix the growth at its source, and the alerts become a safety net instead of a weekly chore.