VMHeaven

Troubleshooting

No space left on device — even when df shows free space

ENOSPC has three causes: a genuinely full disk, exhausted inodes, or a deleted file still held open. How to diagnose and reclaim space for each.

Updated 08 Aug 2026~6 min read

No space left on device (ENOSPC) stops writes cold — logs, databases and package installs all fail. 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?

check usage
df -h        # look for a mount at 100% Use%
df -i        # inode usage — 100% here also causes ENOSPC

If df -h shows 100%, find the biggest offenders:

find what is eating space
sudo du -xh / 2>/dev/null | sort -rh | head -20
# faster interactive tool if installed:
sudo ncdu /

2. The usual space hogs

reclaim common space
# 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 -af

3. 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:

find inode hogs
for d in /var/*; do echo "$(sudo find "$d" 2>/dev/null | wc -l) $d"; done | sort -rn | head

4. 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:

deleted files still held open
sudo lsof +L1 | sort -k7 -rn | head
# restart the service that owns it, or truncate live:
sudo truncate -s 0 /proc/<PID>/fd/<FD>

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.

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.

More in Troubleshooting

See all