CloudLinux.ro
Monitoring & logging

How to monitor disk space and avoid running out

Updated 7/20/2026

When the disk fills up, databases stop, logs stop writing and the site can go down. Prevention is simple.

1. Check space

df -h

2. Find what uses space

du -sh /var/* | sort -h
du -sh /home/* | sort -h

Frequent culprits: uncleaned logs, old backups, unused Docker images (see Docker cleanup).

3. Automatic alert at 85%

A simple script that runs in cron and warns you:

#!/bin/bash
USED=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$USED" -gt 85 ]; then
  echo "Disk at $USED% on $(hostname)" | mail -s "Disk alert" [email protected]
fi
0 * * * * /usr/local/bin/check-disk.sh

4. Free up space

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials