Several different things run out under the same error. Check which before you delete anything.
What it means
The kernel returned ENOSPC because the write needed a resource that has run out. Usually that resource is data blocks, but not always:
- Blocks: the filesystem really is full.
df -hshows 100%. - Inodes: there are too many files.
df -ishows 100% even thoughdf -hshows space. - Deleted but open: a process still holds a deleted file, so its blocks are never freed.
- Reserved blocks: ext4 keeps 5% for root, so normal users hit the limit first.
- Not disk at all:
inotify_add_watchreturns ENOSPC whenfs.inotify.max_user_watchesis used up.
Find which one
df -h # which mount is full (bytes) df -i # inodes per mount sudo lsof +L1 # deleted files still held open
Find what's using the bytes, staying on one filesystem:
sudo du -xh / --max-depth=2 2>/dev/null | sort -h | tail -20
Find what's using the inodes, by counting files per directory:
sudo find / -xdev -type f | cut -d/ -f2-3 | sort | uniq -c | sort -n | tail
Check the usual heavy users:
journalctl --disk-usage docker system df sudo du -sh /var/lib/docker/containers/*/*-json.log | sort -h | tail
Safe quick wins
sudo journalctl --vacuum-size=500M docker system prune # stopped containers, dangling images, build cache sudo truncate -s 0 /var/log/app/huge.log
For a deleted file that's still open, either restart the process or truncate it through its file descriptor:
sudo truncate -s 0 /proc/<pid>/fd/<fd>
Prevent it
- Set log rotation for apps, and
max-sizeandmax-filefor Docker's json-file log driver in/etc/docker/daemon.json. - Cap journald with
SystemMaxUse=injournald.conf. - Alert on both
dfbytes and inodes at 80%, not 95%. - ext4 fixes the inode count at
mkfstime. For volumes holding millions of tiny files, use a higher inode ratio (mkfs.ext4 -i) or XFS, which allocates inodes dynamically. - In Kubernetes, a full node disk triggers DiskPressure and pod evictions. Set
ephemeral-storagelimits.
Common wrong fix
Running rm on the biggest log while the app is writing to it. df doesn't change, because the process still has the file open, and now you can't see what's filling the disk. Use truncate -s 0 on live logs, and run lsof +L1 if space doesn't come back. The second trap is rm -rf on whatever looks large under /var/lib/docker. That corrupts Docker's state. Use docker system prune or remove specific images instead.