↑↓ move Enter open Esc close

No space left on device

A filesystem is full: confirm which one, and whether you ran out of bytes or inodes.

Quick diagnosis

Start here. This one command usually tells you which of the causes below you are dealing with:

$ df -h && df -i

The first shows space, the second shows inodes. Run both before touching anything: they tell you two different stories and the fix differs completely.

Causes, ordered by how often they are the culprit

1 Logs that grew without rotation (most common on servers)

An application logging errors in a loop can fill hundreds of gigabytes overnight. /var is where this almost always happens.

Check
$ du -h --max-depth=1 /var 2>/dev/null | sort -hr | head
Fix
$ sudo journalctl --vacuum-size=200M

For plain files, truncate rather than delete a log a process still holds open: sudo truncate -s 0 /var/log/huge.log. Deleting it would not free the space until the process restarts.

2 Deleted files still held open by a process

The classic head-scratcher: you delete a huge file, du no longer sees it, and df still reports the disk full. The space is not released until the process holding it closes the file.

Check
$ sudo lsof +L1 | sort -k7 -n | tail
Fix
$ sudo systemctl restart theservice

3 Out of inodes, not bytes

Every file consumes an inode. Millions of tiny files: session files, mail queues, cache: can exhaust them while df -h still shows free space.

Check
$ df -i
Fix
$ find /the/directory -type f -delete

If IUse% is at 100% while Use% is not, this is your cause. Find the offender with: for d in /*; do echo "$(find $d -xdev 2>/dev/null | wc -l) $d"; done | sort -rn | head.

4 Docker images, containers and volumes

On development machines and CI runners this is the usual culprit. Docker accumulates layers and orphaned volumes silently.

Check
$ docker system df
Fix
$ docker system prune -a --volumes

That last command deletes unused images AND volumes. Make sure you are not relying on any of them before running it.

5 A different filesystem than the one you checked

/home, /var or /boot are often separate mounts. /boot in particular is small and fills up with old kernels.

Check
$ df -h /the/exact/path/you/were/writing/to
Fix
$ sudo apt autoremove --purge    # clears old kernels from /boot

6 Package manager and build caches

Downloaded packages and build artefacts accumulate quietly.

Check
$ du -sh /var/cache/apt ~/.cache 2>/dev/null
Fix
$ sudo apt clean && rm -rf ~/.cache/*

How to stop it happening again

Frequently asked questions

df says the disk is full but du finds nothing: why?

Deleted files still held open by a running process. Find them with sudo lsof +L1 and restart the process that holds them.

The disk has free space but I still get this error

Check df -i. You are probably out of inodes, which happens with huge numbers of very small files. Deleting files (not freeing bytes) is the fix.

Can I just delete files in /var/log?

Rotated files (.gz, .1) are safe to delete. For an active log, truncate it instead: deleting a file a process has open frees nothing until that process restarts.

Why did /boot fill up?

Kernel updates keep old versions. sudo apt autoremove --purge removes the ones no longer needed.

Commands involved

Concepts behind this error: Inode · Mount · Filesystem hierarchy

How to do it properly

Other errors