How to Check and Monitor Disk Space on Linux
Checking disk space manually
The standard command is:
```
df -h
```
This lists every mounted filesystem with total size, used space, available space, and use percentage, in human-readable units. Look specifically at the `/` (root) and `/var` partitions — `/var` is where logs and often databases live, and it's a common culprit when a server suddenly runs out of space.
To find what's actually consuming space within a directory:
```
du -sh /var/* | sort -rh | head -10
```
This lists the ten largest subdirectories inside `/var`, sorted largest first — usually enough to spot a runaway log file or an old backup nobody cleaned up.
Why disk space problems escalate quickly
Unlike CPU or memory spikes, which are often temporary, a filling disk is usually a one-way trend — and when it hits 100%, the failure mode is ugly: databases can't write, logs can't be written (which then hides the evidence of what went wrong), and some services crash outright. A server at 85% disk usage today can be at 100% next week if the cause isn't addressed.
Common causes worth checking first
• Log files that were never set up with rotation (`logrotate`).
• Old backups accumulating in a directory nobody prunes.
• A crashed process leaving behind large core dump files.
• Docker images and unused containers/volumes piling up over time.
Moving from manual checks to alerts
Running `df -h` when you remember to is better than nothing, but it relies on you remembering — and disk space problems are exactly the kind of slow-building issue manual checks are worst at catching. An automated check that alerts you at, say, 80% and again at 90% used gives you real lead time to clean up or expand storage before it becomes an outage.
CloudStats' [Linux server monitoring](/features/linux-server-monitoring) includes per-partition disk space alerts as a default part of the setup — no separate configuration needed beyond setting your thresholds.