Manage disk space (df, du, ncdu)
A full disk on a HolyCloud Linux VPS can block logs, databases, updates, and even SSH. Learn to measure, locate, and clean space with standard tools df, du, and ncdu.
Prerequisites
- HolyCloud VPS Ubuntu/Debian with sudo access
- Active SSH session
- Ideally a HolyCloud snapshot before large file deletions
Step 1: overview with df
Show usage per partition:
df -hT
Useful columns:
| --------- | --------------- |
|---|---|
| Type | ext4, xfs, tmpfs… |
| Size / Used / Avail | Size and free space |
| Use% | Usage percentage — alert if > 85% |
| Mounted on | Mount point (/, /var, additional volume) |
Inode space (many small files):
df -hi
On HolyCloud, the main disk is usually mounted on /. An additional volume may appear on /mnt/data or similar.
Step 2: find large directories with du
Top 20 folders at root (may take time):
sudo du -xh --max-depth=1 / 2>/dev/null | sort -hr | head -20
Target /var (logs, databases, apt cache):
sudo du -xh --max-depth=1 /var | sort -hr | head -15
System logs:
sudo du -sh /var/log/*
sudo journalctl --disk-usage
Step 3: interactive analysis with ncdu
Install ncdu:
sudo apt update
sudo apt install -y ncdu
Scan root:
sudo ncdu /
Navigation: arrow keys, Enter to enter, d to delete (careful), q to quit.
Scan only /var/log:
sudo ncdu /var/log
Step 4: common safe cleanup
APT package cache:
sudo apt autoremove -y
sudo apt clean
Old kernels (Ubuntu, keep the current one):
dpkg -l 'linux-image-*' | grep ^ii
sudo apt autoremove --purge -y
systemd journal (limit to 500 MB):
sudo journalctl --vacuum-size=500M
Compressed or rotated Nginx/Apache logs — verify before deletion:
sudo ls -lh /var/log/nginx/
sudo truncate -s 0 /var/log/nginx/access.log
Docker containers (if installed):
docker system df
docker system prune -a
Warning: do not delete
/var/lib/mysqlor/var/lib/postgresqlwithout a backup.
Step 5: proactive monitoring
Weekly cron script (e.g. /usr/local/bin/check-disk.sh):
#!/bin/bash
THRESH=85
USE=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$USE" -ge "$THRESH" ]; then
echo "ALERTE disque : ${USE}% utilisé sur $(hostname)" | logger -t disk-alert
fi
sudo chmod +x /usr/local/bin/check-disk.sh
echo '0 8 * * 1 root /usr/local/bin/check-disk.sh' | sudo tee /etc/cron.d/disk-check
In the HolyCloud customer area, also watch disk usage graphs if available.
Step 6: expand disk on HolyCloud side
If cleanup is not enough:
- Increase disk size or migrate to a higher plan from the HolyCloud panel
- After hypervisor resize, extend the Linux partition (GPT,
growpart,resize2fs— see the additional volume doc)
Verification
df -hT
sudo du -sh /var/log /var/cache /tmp /home
Need help?
No space left on device: free/tmpand/var/logfirst- Disk full but few visible files: check
docker, local snapshots, deleted files still open (lsof | grep deleted) - HolyCloud support:
df -hToutput,ncduorduon/var, VPS plan and contracted disk size