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:

Server
$ cp /etc/services ~/services.copycp: error copying '/etc/services' to '/home/deploy/services.copy': No space left on device
Output hidden (1 line)
Server
$ df -h /Filesystem      Size  Used Avail Use% Mounted on/dev/vda1        24G   24G     0 100% /
Output hidden (2 lines)

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:

Server
$ sudo tune2fs -l $(findmnt -no SOURCE /) | grep -E '^(Block count|Reserved block count|Block size):'Block count:              6263035Reserved block count:     0Block size:               4096
Output hidden (3 lines)

Ubuntu’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:

Server
$ sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -n 46.1M	/etc1.8G	/usr22G	/var24G	/
Output hidden (4 lines)
Server
$ sudo du -xh --max-depth=1 /var 2>/dev/null | sort -h | tail -n 370M	/var/lib22G	/var22G	/var/tmp
Output hidden (3 lines)

Almost all of /var is in /var/tmp. To jump straight to big files, find lists every file over 100 MB on that filesystem:

Server
$ 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.tar
Output hidden (2 lines)

A 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:

Server
$ sudo journalctl --disk-usageArchived and active journals take up 20.9M in the file system.
Output hidden (1 line)
Server
$ sudo rm /var/tmp/build-cache/layer.tar
Server
$ df -h /Filesystem      Size  Used Avail Use% Mounted on/dev/vda1        24G  2.0G   22G   9% /
Output hidden (2 lines)
Server
$ cp /etc/services ~/services.copy && ls -l ~/services.copy-rw-r--r-- 1 deploy deploy 12990 Nov 19 17:19 /home/deploy/services.copy
Output hidden (1 line)

df 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:

Server
$ ls -lh /var/log/demo-app.log-rw-r--r-- 1 root root 1.0G Nov 19 17:19 /var/log/demo-app.log
Output hidden (1 line)
Server
$ sudo rm /var/log/demo-app.log
Server
$ df -h /Filesystem      Size  Used Avail Use% Mounted on/dev/vda1        24G  3.0G   21G  13% /
Output hidden (2 lines)

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):

Server
$ 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)
Output hidden (3 lines)

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:

Server
$ sudo systemctl restart demo-app
Server
$ sudo lsof -nP +L1 | grep -c 'demo-app.log (deleted)'0
Output hidden (1 line)

Next 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:

Server
$ touch /srv/cache/static/new.csstouch: cannot touch '/srv/cache/static/new.css': No space left on device
Output hidden (1 line)
Server
$ df -h /srv/cacheFilesystem      Size  Used Avail Use% Mounted ontmpfs            64M  4.0K   64M   1% /srv/cache
Output hidden (2 lines)
Server
$ df -i /srv/cacheFilesystem     Inodes IUsed IFree IUse% Mounted ontmpfs            2000  2000     0  100% /srv/cache
Output hidden (2 lines)

df -h says 1% used, df -i says 100%. Count the files per folder to find where they are:

Server
$ 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/sessions
Output hidden (2 lines)

Delete them (here all the session files; on a live site, select only the old ones by age):

Server
$ find /srv/cache/sessions -type f -name 'sess_*' -delete
Server
$ df -i /srv/cacheFilesystem     Inodes IUsed IFree IUse% Mounted ontmpfs            2000     4  1996    1% /srv/cache
Output hidden (2 lines)
Server
$ touch /srv/cache/static/new.css && ls /srv/cache/staticnew.css  site.css
Output hidden (1 line)

Troubleshooting

  • df -h shows free space: run df -i; the inodes may be gone. Details.
  • df says full, du finds much less: a deleted file is still open. Details.
  • Even sudo cannot write: Ubuntu’s cloud image keeps no reserve for root. Details.
  • du counts other disks or takes ages: add -x to 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:

WhatUbuntu 26.04Ubuntu 24.04
SystemUbuntu 26.04.1 LTS7.0.0-43-genericUbuntu 24.04.5 LTS6.8.0-147-generic
coreutils9.5-1ubuntu2+0.0.0~ubuntu259.4-3ubuntu6.3
util-linux2.41.3-3ubuntu2.22.39.3-9ubuntu6.6
e2fsprogs1.47.2-3ubuntu41.47.0-2.4~exp1ubuntu4.1
findutils4.10.0-3build24.9.0-5build1
lsof4.99.4+dfsg-2build24.95.0-1build3
systemd259.9-0ubuntu0.1255.4-1ubuntu8.18
lsof +L1 on a fresh serveralso lists a tiny /memfd:systemd-udevd (deleted) held by systemd (normal)only the deleted log
ProofRun log, 28 checks passedRun log, 28 checks passed