ENOSPC
Linux / POSIXERRORCriticalFile SystemHIGH confidence

No Space Left on Device

Production Risk

A full production filesystem will cause write failures across all services. Set up disk space alerts at 80% and 90% thresholds.

What this means

The filesystem has no free blocks remaining. This prevents any new data from being written. Note that a filesystem can also return ENOSPC when inodes are exhausted even if block space is available.

Why it happens
  1. 1The filesystem partition has filled up entirely.
  2. 2Inode count is exhausted even though disk blocks remain free.
  3. 3A runaway log file or core dump filled the filesystem.
  4. 4A large number of small files exhausted the inode table on an ext4 filesystem.
How to reproduce

Writing to a filesystem that has run out of free space.

trigger — this will error
trigger — this will error
$ cp large_file.iso /mnt/full/
cp: error writing '/mnt/full/large_file.iso': No space left on device

expected output

cp: error writing '/mnt/full/large_file.iso': No space left on device

Fix

Free disk space by removing large or unnecessary files

WHEN When the filesystem is genuinely full

Free disk space by removing large or unnecessary files
# Find largest directories
du -sh /* 2>/dev/null | sort -rh | head -20

# Check inode usage too
df -i

# Rotate or truncate large log files
sudo truncate -s 0 /var/log/syslog

Why this works

Removing files frees the blocks they occupied, allowing new writes to succeed.

What not to do

Delete files and expect immediate space recovery without syncing

Files with open handles are not removed from disk until all handles are closed, even if unlinked.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors