Knowledge

No space left on device on Ubuntu

#Hosting

This error means a filesystem is full, or out of inodes. Here is how to find what is eating the disk and reclaim it safely without breaking your server.

Published by Mark van Eijk on June 23, 2026 · 1 minute read

  1. About the error
  2. Find what's full
  3. Common culprits and fixes
  4. Systemd journal logs
  5. Application and web server logs
  6. Package cache
  7. Old kernels and Docker

About the error

You'll see it from almost any program that tries to write:

write error: No space left on device

It means the filesystem you're writing to is full. Occasionally the disk has free bytes but has run out of inodes (the structures that track files), which produces the same message.

Find what's full

Start with a summary of disk usage per filesystem:

df -h

If a filesystem shows 100% but you can't see why, check inodes too:

df -i

Then find the biggest directories on the full filesystem:

sudo du -h --max-depth=1 / | sort -hr | head -20

Drill down into whichever directory is largest by repeating du one level deeper.

Common culprits and fixes

Systemd journal logs

The journal under /var/log/journal can quietly grow to gigabytes. Trim it:

sudo journalctl --vacuum-time=7d
# or cap by size
sudo journalctl --vacuum-size=200M

Cap it permanently in /etc/systemd/journald.conf:

SystemMaxUse=200M

Application and web server logs

A runaway log file (nginx, Laravel, a stuck cron) is a classic cause. Truncate it in place rather than deleting it, so the writing process keeps its file handle:

sudo truncate -s 0 /var/log/nginx/error.log

Set up logrotate so it can't happen again.

Package cache

On a server that's been updated a lot, the apt cache reclaims gigabytes:

sudo apt clean
sudo apt autoremove --purge

Old kernels and Docker

Old kernels and unused Docker images/volumes are frequent space hogs:

sudo apt autoremove --purge   # removes old kernels
docker system prune -a        # if you run Docker

For more cleanup ideas see reclaiming disk space on Ubuntu. If the disk filled because of swap or you have none, see adding swap space on Ubuntu.

Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

Related articles

How to get top processes with highest memory usage

This error means a filesystem is full, or out of inodes. Here is how to find what is eating the disk and reclaim it safely without breaking your server.

Read more →

How to get top processes with highest CPU usage

This error means a filesystem is full, or out of inodes. Here is how to find what is eating the disk and reclaim it safely without breaking your server.

Read more →