> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Fix "No Space Left on Device" on Linux

> Fix "No space left on device" on Linux: check df -h and df -i, delete or vacuum large files and logs, and free space held by deleted files that are still open.

"No space left on device" means a filesystem can't store any more data. Usually the disk is full, but it can also run out of inodes (file slots) or keep space for deleted files that a program still has open. Run `df -h` and `df -i` to see which, find the large folders with `sudo du -xh / --max-depth=1 | sort -h`, then delete or shrink what you don't need.

```text theme={null}
write error: No space left on device
touch: cannot touch 'file': No space left on device
```

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 10 to 20 minutes | Ubuntu 22.04 / 24.04, Debian 12 / 13, AlmaLinux and Rocky Linux 9 / 10 | Root or sudo access |

## Before you start

* A full disk breaks databases, logins and package updates. Free a little space first, then look for the cause.
* Don't delete files you don't recognise in `/usr`, `/lib`, `/boot` or `/var/lib`. Remove logs, caches, old backups and downloads instead.
* Commands use `sudo`. As root, leave it out.

## Step 1: Find out which kind of "full" it is

```bash theme={null}
df -h
df -i
```

| What you see | Cause |
| - | - |
| `Use%` at or near `100%` in `df -h` | The disk is full (Cause 1) |
| `IUse%` at `100%` in `df -i`, but free space in `df -h` | Out of inodes (Cause 2) |
| `df -h` shows full, but `du` finds much less | Deleted files still open (Cause 3) |
| `Size` is larger than `Used`, yet `Avail` is `0` | Reserved blocks: only root can still write (Cause 4) |

Check the **mount point** in the last column too. A full `/boot`, `/tmp` or `/var` gives the same error even when `/` has room.

## Cause 1: The disk is full

**Check** which top-level folders are largest, then go one level deeper into the biggest:

```bash theme={null}
sudo du -xh / --max-depth=1 2>/dev/null | sort -h | tail -10
sudo du -xh /var --max-depth=1 2>/dev/null | sort -h | tail -10
```

List single large files:

```bash theme={null}
sudo find / -xdev -type f -size +500M -exec ls -lh {} + 2>/dev/null
```

**Fix** the usual space users:

> [tab] Logs
>
> Shrink the systemd journal to 200 MB:
>
> ```bash theme={null}
> sudo journalctl --vacuum-size=200M
> ```
>
> Empty a huge log file without deleting it (the program keeps writing to it):
>
> ```bash theme={null}
> sudo truncate -s 0 /var/log/nginx/access.log
> ```

> [tab] Package cache
>
> Ubuntu / Debian:
>
> ```bash theme={null}
> sudo apt clean
> sudo apt autoremove --purge
> ```
>
> AlmaLinux / Rocky:
>
> ```bash theme={null}
> sudo dnf clean all
> sudo dnf autoremove
> ```

> [tab] Docker
>
> Images, stopped containers and build cache grow quietly. See [clean up Docker disk space](https://help.freakhosting.com/portals/other/how-to-clean-up-docker-disk-space.md).

Old backups, database dumps and game server worlds in home folders are other common finds. For a guided search, see [find what is using disk space](https://help.freakhosting.com/portals/other/how-to-find-what-is-using-disk-space-on-linux.md).

## Cause 2: Out of inodes

Every file uses one inode. Millions of tiny files (session files, cache files, mail queues) can use them all while plenty of space is left.

**Check** which folder holds the most files:

```bash theme={null}
sudo find / -xdev -type f 2>/dev/null | cut -d/ -f2-3 | sort | uniq -c | sort -n | tail -5
```

**Fix:** delete the unneeded small files in that folder, for example old PHP sessions or a cache directory, and fix the program that creates them.

## Cause 3: Deleted files still held open

When you delete a log file that a running program still writes to, the space isn't freed until that program closes it.

**Check:**

```bash theme={null}
sudo lsof +L1
```

```text theme={null}
COMMAND  PID     USER  FD  TYPE DEVICE  SIZE/OFF NLINK NODE NAME
nginx    812 www-data  5w   REG  252,1  6291456     0   22 /var/log/nginx/access.log (deleted)
```

**Fix:** restart the program shown (here `sudo systemctl restart nginx`). If you can't restart it, empty the file through its file descriptor (`PID` and `FD` number from the output):

```bash theme={null}
sudo truncate -s 0 /proc/812/fd/5
```

Install `lsof` first if it's missing: `sudo apt install lsof` or `sudo dnf install lsof`.

## Cause 4: Reserved blocks on ext4

ext4 keeps 5% of the space for root by default, so system services keep working when users fill the disk. Normal users then see the error while `df` still shows a little room. Free space as in Cause 1. Don't remove the reserve on the root filesystem.

## Cause 5: The disk is bigger, but the partition isn't

If you upgraded your plan and `lsblk` shows a larger disk than `df -h` shows for `/`, the extra space isn't in use yet. See [resize a partition after a disk upgrade](https://help.freakhosting.com/portals/other/how-to-resize-a-partition-after-a-disk-upgrade.md) and [manage VPS storage](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md).

## How to check it worked

```bash theme={null}
df -h /
```

`Use%` should be well under 100%. Keep at least 10 to 15% free so logs and updates have room.

## Frequently asked questions

### I deleted files but df still shows the disk full. Why?

A program still has them open. Run `sudo lsof +L1` and restart that program (Cause 3).

### Can a full disk stop my server from booting?

It can stop services such as databases from starting and can block logins that need to write files. Free space from the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) or [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md) if SSH fails.

### How do I stop this happening again?

Limit the journal with `SystemMaxUse=500M` in `/etc/systemd/journald.conf`, make sure logrotate runs, and set up [disk alerts](https://help.freakhosting.com/portals/other/how-to-get-email-alerts-when-your-server-goes-down.md).

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Check disk space](https://help.freakhosting.com/portals/other/how-to-check-disk-space-on-linux.md)
>
> Read df and du output.

> [card] [Find what uses disk space](https://help.freakhosting.com/portals/other/how-to-find-what-is-using-disk-space-on-linux.md)
>
> Track down the biggest folders.

> [card] [Clean up Docker disk space](https://help.freakhosting.com/portals/other/how-to-clean-up-docker-disk-space.md)
>
> Remove unused images and volumes.

> [card] [Read-only file system errors](https://help.freakhosting.com/portals/other/how-to-fix-read-only-file-system-errors.md)
>
> A different reason writes fail.

***

> [!NOTE]
>
> **Checked against the official [journalctl manual](https://www.freedesktop.org/software/systemd/man/latest/journalctl.html), [journald.conf manual](https://www.freedesktop.org/software/systemd/man/latest/journald.conf.html) and [tune2fs manual](https://man7.org/linux/man-pages/man8/tune2fs.8.html)** on 4 November 2026; the full-disk and out-of-inodes errors, `lsof +L1`, truncating a deleted open file and the 5% ext4 reserve were reproduced on small test filesystems on Ubuntu 24.04 LTS. The `dnf` commands were not tested.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.