Short answer
“No space left on device” means a filesystem is out of space or out of inodes. Run df -h to see which one is full, then df -i if it still shows free space. Find what fills it with sudo du -xh --max-depth=1 / | sort -h, going one folder deeper each time. If df says full but du finds nothing, run sudo lsof -nP +L1.
Tested on Ubuntu 26.04 and 24.04, two separate runs. On 24.04, every step is the same. Everything that differed
Step 1: which filesystem is full
On the test server, copying a small file failed:
$ cp /etc/services ~/services.copycp: error copying '/etc/services' to '/home/deploy/services.copy': No space left on device$ df -h /Filesystem Size Used Avail Use% Mounted on/dev/vda1 24G 24G 0 100% /Avail 0 and 100%. Without a path, df -h lists every filesystem; the one that matters is the one the failing path lives on (/home/deploy is on / here).
Can root still write? Not on a cloud image
Many guides say ext4 keeps 5% of the disk for root, so sudo and the system logs keep working when users are out of space. That is ext4’s default, but check your own server:
$ sudo tune2fs -l $(findmnt -no SOURCE /) | grep -E '^(Block count|Reserved block count|Block size):'Block count: 6263035Reserved block count: 0Block size: 4096Ubuntu’s cloud images set the reserve to 0, on both 26.04 and 24.04. A full disk is full for root too, so services can fail to write their logs, state and databases. Free space first, before you restart anything.
Step 2: find what fills it
du -x stays on one filesystem, so other disks and /proc are not counted. Start at /, then go into the biggest folder:
$ sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -n 46.1M /etc1.8G /usr22G /var24G /$ sudo du -xh --max-depth=1 /var 2>/dev/null | sort -h | tail -n 370M /var/lib22G /var22G /var/tmpAlmost all of /var is in /var/tmp. To jump straight to big files, find lists every file over 100 MB on that filesystem:
$ sudo find / -xdev -type f -size +100M -exec ls -lh {} + 2>/dev/null-rw-r--r-- 1 root root 133M Mar 18 2026 /usr/lib/x86_64-linux-gnu/libLLVM.so.21.1-rw-r--r-- 1 root root 22G Nov 19 17:18 /var/tmp/build-cache/layer.tarA 22 GB file left behind in /var/tmp (a build cache, a backup, a download). The library on the first line belongs to the system: leave files under /usr alone. The usual suspects on a server are logs, backups and container data. The system journal is rarely the culprit on a small server, but check it:
$ sudo journalctl --disk-usageArchived and active journals take up 20.9M in the file system.$ sudo rm /var/tmp/build-cache/layer.tar$ df -h /Filesystem Size Used Avail Use% Mounted on/dev/vda1 24G 2.0G 22G 9% /$ cp /etc/services ~/services.copy && ls -l ~/services.copy-rw-r--r-- 1 deploy deploy 12990 Nov 19 17:19 /home/deploy/services.copydf says full, but du cannot find the files
A file you delete only disappears when no program has it open. A log that a running service still writes to keeps its space after rm. The test runs a small service that holds a 1 GB log:
$ ls -lh /var/log/demo-app.log-rw-r--r-- 1 root root 1.0G Nov 19 17:19 /var/log/demo-app.log$ sudo rm /var/log/demo-app.log$ df -h /Filesystem Size Used Avail Use% Mounted on/dev/vda1 24G 3.0G 21G 13% /The file is gone from the folder, but df still counts its gigabyte, and du cannot see it. lsof +L1 lists open files with no name left on disk (NLINK 0):
$ sudo lsof -nP +L1COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAMEsystemd 1 root 235u REG 0,1 20 0 1029 /memfd:systemd-udevd (deleted)python3 3677 root 3w REG 253,1 1073741824 0 101564 /var/log/demo-app.log (deleted)python3, PID shown, holds /var/log/demo-app.log (deleted), and SIZE/OFF is its size in bytes: 1 GB. On 26.04 a tiny systemd … /memfd:systemd-udevd (deleted) line also shows; that is normal and only a few bytes. Restart the service that owns the process, so it closes the file:
$ sudo systemctl restart demo-app$ sudo lsof -nP +L1 | grep -c 'demo-app.log (deleted)'0Next time, empty a big log that is in use instead of deleting it: the Docker logs answer shows truncate doing that, with the space back at once and the program still writing.
Out of inodes: free space, but no new files
Every file uses one inode, and a filesystem has a fixed number. A folder with millions of tiny files (sessions, cache entries, mail queues) can use them all while gigabytes are still free. The test uses a small filesystem with 2000 inodes and a folder of session files:
$ touch /srv/cache/static/new.csstouch: cannot touch '/srv/cache/static/new.css': No space left on device$ df -h /srv/cacheFilesystem Size Used Avail Use% Mounted ontmpfs 64M 4.0K 64M 1% /srv/cache$ df -i /srv/cacheFilesystem Inodes IUsed IFree IUse% Mounted ontmpfs 2000 2000 0 100% /srv/cachedf -h says 1% used, df -i says 100%. Count the files per folder to find where they are:
$ sudo find /srv/cache -xdev -type f | cut -d/ -f1-4 | sort | uniq -c | sort -n | tail -n 3 1 /srv/cache/static 1996 /srv/cache/sessionsDelete them (here all the session files; on a live site, select only the old ones by age):
$ find /srv/cache/sessions -type f -name 'sess_*' -delete$ df -i /srv/cacheFilesystem Inodes IUsed IFree IUse% Mounted ontmpfs 2000 4 1996 1% /srv/cache$ touch /srv/cache/static/new.css && ls /srv/cache/staticnew.css site.cssTroubleshooting
df -hshows free space: rundf -i; the inodes may be gone. Details.dfsays full,dufinds much less: a deleted file is still open. Details.- Even
sudocannot write: Ubuntu’s cloud image keeps no reserve for root. Details. ducounts other disks or takes ages: add-xto stay on one filesystem. Details.
What these steps changed on the server
Both runs recorded the server before the first step and after the last (see the Tested on box below): the big cache file is gone and the disk has its free space back.
Ubuntu 26.04 vs 24.04
The same check ran on a fresh 26.04 server and on a fresh 24.04 server, each with its own run log. The error messages, the missing root reserve and every fix were the same. The only difference in the output:
| What | Ubuntu 26.04 | Ubuntu 24.04 |
|---|---|---|
| System | Ubuntu 26.04.1 LTS7.0.0-43-generic | Ubuntu 24.04.5 LTS6.8.0-147-generic |
| coreutils | 9.5-1ubuntu2+0.0.0~ubuntu25 | 9.4-3ubuntu6.3 |
| util-linux | 2.41.3-3ubuntu2.2 | 2.39.3-9ubuntu6.6 |
| e2fsprogs | 1.47.2-3ubuntu4 | 1.47.0-2.4~exp1ubuntu4.1 |
| findutils | 4.10.0-3build2 | 4.9.0-5build1 |
| lsof | 4.99.4+dfsg-2build2 | 4.95.0-1build3 |
| systemd | 259.9-0ubuntu0.1 | 255.4-1ubuntu8.18 |
lsof +L1 on a fresh server | also lists a tiny /memfd:systemd-udevd (deleted) held by systemd (normal) | only the deleted log |
| Proof | Run log, 28 checks passed | Run log, 28 checks passed |
