Updated: 4 November 2026 · Applies to: Linux file systems (ext4 and tmpfs tested with Linux 6.12, coreutils 9.7, e2fsprogs 1.47.2 and lsof 4.99 on Debian 13); the same commands work on Ubuntu, AlmaLinux and Rocky Linux
No space left on device (error code 28, ENOSPC) means Linux could not find room to write. There are three common causes: the file system is full (df -h shows 100%), it has run out of inodes (df -i shows 100% while df -h still has free space), or a deleted file is still held open by a running program, so its space is not released. Run both checks on the folder from the error message first:
df -h /var df -i /var
Then follow the section that matches what you see. All the output below is from our test lab (a small ext4 disk on a test kernel), not from a customer server.
What the error looks like
Each program words the same kernel error its own way:
dd: error writing '/mnt/t/logs/fill': No space left on device cp: error writing '/mnt/t/logs/services': No space left on device touch: cannot touch '/mnt/i/sess/s116': No space left on device
Databases and other programs often show only the number, for example Errcode: 28: 28 is the same error.
1. The disk is full: find what uses the space
$ df -h /mnt/t Filesystem Size Used Avail Use% Mounted on /dev/ubda 55M 54M 0 100% /mnt/t
Avail 0 and Use% 100% mean a real space problem. df -hT adds the file system type, which matters for section 5. Find the largest folders, staying on the full file system with -x:
$ sudo du -xh -d 1 /mnt/t | sort -h 12K /mnt/t/lost+found 3.2M /mnt/t/logs 21M /mnt/t/home 31M /mnt/t/backups 54M /mnt/t
On a real server start with sudo du -xh -d 1 / | sort -h | tail, then repeat the command on the largest folder until you reach the files. To list big files directly:
$ sudo find /mnt/t -xdev -type f -size +10M -exec ls -lh {} +
-rw-r--r-- 1 root root 30M Oct 11 15:33 /mnt/t/backups/site-backup.tar
-rw-r--r-- 1 alice alice 21M Oct 11 15:33 /mnt/t/home/alice/video.mp4
Use -size +500M on a large disk. More options: find the largest files and directories in Linux. Deleting video.mp4 and a smaller file took the lab disk from 100% to 60%. Common places to clean, safest first:
- Old backups and archives you have already copied elsewhere.
- The systemd journal:
journalctl --disk-usageshows its size;sudo journalctl --rotate --vacuum-size=200Mtrims it to 200 MB (according to the journalctl manual, vacuuming only removes archived files, so--rotatearchives the active ones first). See journalctl examples. - Large log files: empty a log that a program is still writing with
sudo truncate -s 0 /var/log/FILE.loginstead of deleting it (see section 2), then set up log rotation with logrotate. - Package caches:
sudo apt cleanandsudo apt autoremove --purgeon Debian and Ubuntu,sudo dnf clean allon AlmaLinux and Rocky Linux (clean the DNF cache). - Docker:
docker system dfshows the usage. According to Docker,docker system pruneremoves stopped containers, unused networks, dangling images and build cache, and keeps volumes unless you add--volumes. - A full /boot is usually old kernels: see more space needed on the /boot filesystem.
2. df says full, du says otherwise: deleted files that are still open
When you delete a file that a program still has open, the name disappears but the space is only released when the program closes it. A big log deleted with rm while the service runs is the usual case. In the lab, a running process still had an app.log of about 23 MB open:
$ rm /mnt/t/logs/app.log $ df -h /mnt/t Filesystem Size Used Avail Use% Mounted on /dev/ubda 55M 54M 0 100% /mnt/t $ sudo du -sh /mnt/t 31M /mnt/t
The disk is still full, and du counts 23 MB less than df. List deleted files that are still open:
$ sudo lsof +L1 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME tail 778 root 3r REG 98,0 24526848 0 18 /mnt/t/logs/app.log (deleted)
NLINK 0 means the file has no name any more; SIZE/OFF is the space it still holds. To free it, do one of these:
- Restart the program that holds it, for example
sudo systemctl restart SERVICE. This is the clean fix. - If you cannot restart it now, empty the file through the process’s file descriptor (PID 778 and descriptor 3 from the lsof line):
sudo truncate -s 0 /proc/778/fd/3
In our tests, emptying the descriptor released all of the space at once while the process kept running, andlsofthen showed the file with size 0.
Without lsof, sudo find /proc/*/fd -ls | grep '(deleted)' shows the same files.
3. The disk has space but no inodes are left
Every file and folder uses one inode, and on ext4 their number is fixed when the file system is created. Millions of tiny files (sessions, cache entries, a stuck mail queue) can use them all up while the disk is almost empty:
$ touch /mnt/i/sess/s116 touch: cannot touch '/mnt/i/sess/s116': No space left on device $ df -h /mnt/i Filesystem Size Used Avail Use% Mounted on /dev/ubdb 15M 49K 14M 1% /mnt/i $ df -i /mnt/i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/ubdb 128 128 0 100% /mnt/i
Find the folder with the most files with sudo du --inodes -x -d 1 / | sort -n | tail and delete what is not needed with find ... -delete. The full method, and how to get more inodes on ext4 and XFS, is in inodes in Linux: check usage, find files and increase inodes.
4. A normal user gets the error, root does not: reserved blocks
ext4 keeps 5% of the blocks for root by default, so that root can still log in and repair a full system. A normal user hits the error first, and df already shows Avail 0:
$ dd if=/dev/zero of=/mnt/t/home/alice/video.mp4 bs=1M count=100 dd: error writing '/mnt/t/home/alice/video.mp4': No space left on device $ df -h /mnt/t Filesystem Size Used Avail Use% Mounted on /dev/ubda 55M 51M 0 100% /mnt/t
Root could still write 3 MB more in the lab. The fix is to free space as in section 1. On a separate data disk (not /) you can lower the reserve: sudo tune2fs -l /dev/sdX1 | grep -i "reserved block count" shows it, and sudo tune2fs -m 1 /dev/sdX1 sets it to 1% (it printed Setting reserved blocks percentage to 1% (655 blocks) and worked while the disk was mounted). Keep the default on the root file system.
5. Other causes
- A tmpfs is full.
/tmp,/dev/shmand/runcan be tmpfs, which lives in memory and has its own size limit;df -hT /tmpshowstmpfsin the Type column. According to the Debian 13 release notes, Debian 13 puts/tmpon tmpfs by default (up to 50% of RAM). Delete files there, write large temporary files to a disk folder such as/var/tmp, or raise the limit until the next reboot:sudo mount -o remount,size=2G /tmp(in the lab, a remount from 8 MB to 16 MB let a 12 MB file through). - File watchers (inotify). If a program that watches files reports this error while every disk has space, the inotify watch limit is reached. With the limit set to 10 in the lab, the eleventh watch failed with
errno 28 = No space left on deviceand inotifywait saidupper limit on inotify watches reached!. Check it withsysctl fs.inotify.max_user_watchesand raise it permanently:echo "fs.inotify.max_user_watches = 524288" | sudo tee /etc/sysctl.d/90-inotify.conf sudo sysctl --system
- Disk quota. A user or hosting account over its quota gets
Disk quota exceededinstead, which is a different error: see fix Disk Quota Exceeded. In cPanel, the Disk Space Usage tool shows which folders use your account’s space.
Stop it happening again
Alert on both df -h and df -i above 80 to 90%, rotate logs, keep backups on another server, and cap the journal with SystemMaxUse= in the [Journal] section of /etc/systemd/journald.conf (by default it may use 10% of the file system, at most 4 GB).
Prefer to have an engineer find and clear it for you? Our Hire an Expert engineers work from $8 per 15 minutes, with no long-term contract.
Official documentation: journalctl(1), docker system prune and tune2fs(8).