No space left on device (ENOSPC) stops writes cold: logs, databases and package installs all fail, and a website often shows a 500 Internal Server Error before anyone sees the message. Usually the disk is genuinely full, but two sneakier causes give the same message with gigabytes apparently free: exhausted inodes, or a large file still held open after deletion. Check all three.
1. Is the disk actually full?
df -h # look for a mount at 100% Use%
df -i # inode usage — 100% here also causes ENOSPCIf df -h shows 100%, find the biggest offenders:
sudo du -xh / 2>/dev/null | sort -rh | head -20
# faster interactive tool if installed:
sudo ncdu /2. The usual space hogs
# apt cache
sudo apt clean
# old journald logs — cap them at 200M
sudo journalctl --vacuum-size=200M
# rotated logs
sudo find /var/log -type f -name "*.gz" -delete
# unused Docker layers (can be huge)
docker system prune -af3. Free space but still ENOSPC: inodes
Millions of tiny files (session caches, mail queues) exhaust inodes while bytes remain. If df -i shows 100%, find the directory with the most files and clear it:
for d in /var/*; do echo "$(sudo find "$d" 2>/dev/null | wc -l) $d"; done | sort -rn | head4. Free space but still full: a deleted-but-open file
A service writing to a log you already rm’d keeps the space allocated until it closes the file. df and du disagree in this case. Find it:
sudo lsof +L1 | sort -k7 -rn | head
# restart the service that owns it, or truncate live:
sudo truncate -s 0 /proc/<PID>/fd/<FD>A full /boot is the one case that can outlive the cleanup: a kernel update that ran out of room there leaves a half-written initramfs behind, and the next boot fails. If the server has started restarting or stopping during boot since the disk filled, see VPS keeps rebooting.
Longer term: more disk
If cleanup only buys a few days, the volume is undersized for the workload. VMHeaven plans run on replicated NVMe storage and can be resized: see the Standard KVM line for capacity that keeps ahead of your logs and data. When only the disk is short, not CPU or RAM, storage blocks add 15 GB each for €1.00 a month from the panel while the server keeps running; then extend the partition and filesystem to use them.
Frequently asked
df says there is free space but I still get ENOSPC. Why?
Two common reasons: inodes are exhausted (check 'df -i'), or a process still holds a deleted file open, keeping its space allocated. Restart that process or truncate the fd.
What is safe to delete first?
Caches and logs: 'apt clean', 'journalctl --vacuum-size=200M', old *.gz logs, and 'docker system prune -af'. Avoid touching /var/lib (databases) and /boot.
How do I find what is filling the disk?
Run 'sudo du -xh / | sort -rh | head -20', or use ncdu for an interactive view.