> ## 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 Check Disk Space on Linux with df and du

> Check disk space on Linux with df -h for free space per disk, and du -sh or du -h --max-depth=1 to see which folders are large. Includes inodes and ncdu.

To check disk space on Linux, run `df -h`: it lists each file system with its size, used and available space and use percentage. To see what is using the space, run `sudo du -h --max-depth=1 / | sort -h`, which lists the size of each top-level folder, then repeat inside the largest one. `du -sh /var/log` shows the total size of a single folder.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 5 minutes | Every Linux distribution | sudo to read all folders |

## Before you start

* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). `df` works for any user. `du` needs `sudo` (root can leave it out) to read folders you don't own.
* **df** (disk free) reports per file system. **du** (disk usage) adds up file sizes inside folders.

## How to check free disk space with df

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

Example output:

```text theme={null}
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        79G   31G   45G  41% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
/dev/vda15      105M  6.1M   99M   6% /boot/efi
```

| Column | Meaning |
| - | - |
| `Filesystem` | The disk or partition |
| `Size` / `Used` / `Avail` | Total, used and free space (`-h` shows K, M, G) |
| `Use%` | How full it is. Act before it reaches 90% |
| `Mounted on` | Where you reach it in the folder tree |

Useful variations:

```bash theme={null}
df -h /             # only the file system that holds /
df -hT              # add the file system type (ext4, xfs)
df -h -x tmpfs -x devtmpfs   # hide memory-based file systems
```

`tmpfs` and `devtmpfs` live in RAM, not on your disk. Your main disk is usually the line mounted on `/`.

## How to find which folders use the most space with du

**1. Size of each top-level folder**

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

`-x` stays on one file system, so it skips `/proc` and other disks. `sort -h` puts the largest at the bottom.

```text theme={null}
1.2G	/usr
3.8G	/home
21G	/var
27G	/
```

**2. Go one level deeper**

```bash theme={null}
sudo du -h --max-depth=1 /var | sort -h
```

Repeat on the largest folder until you find the cause, for example `/var/log` or `/var/lib/docker`.

**3. Total size of one folder**

```bash theme={null}
sudo du -sh /var/log
```

```text theme={null}
2.4G	/var/log
```

### How to list the largest files

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

This lists every file over 500 MB on the main file system.

## How to browse disk usage with ncdu

`ncdu` is an interactive `du`: it scans once, then you browse with the arrow keys.

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo apt install ncdu
> sudo ncdu -x /
> ```

> [tab] AlmaLinux / Rocky
>
> ```bash theme={null}
> sudo dnf install epel-release
> sudo dnf install ncdu
> sudo ncdu -x /
> ```

Press `Enter` to open a folder, `d` to delete the selected item (it asks first) and `q` to quit.

## What if df says the disk is full but du doesn't add up?

| Symptom | Cause | Check |
| - | - | - |
| `No space left on device` but `df -h` shows free space | Out of **inodes** (too many small files) | `df -i` and look at `IUse%` |
| `df` shows more used than `du` finds | A deleted file is still held open by a program | `sudo lsof +L1`, then restart that service |
| Disk fills fast | Logs, backups, Docker images, caches | `du` on `/var/log`, `/var/lib/docker`, `/home` |

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

```text theme={null}
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/vda1       5242880 382004  4860876    8% /
```

For a step-by-step clean-up, see [fix "No space left on device"](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md) and [find what is using disk space](https://help.freakhosting.com/portals/other/how-to-find-what-is-using-disk-space-on-linux.md).

> [!WARNING]
>
> Don't delete files in `/usr`, `/lib`, `/boot`, `/var/lib/dpkg` or `/var/lib/rpm` to free space; that breaks the system. Safe places to start are old logs (`sudo journalctl --vacuum-size=500M`), the package cache (`sudo apt clean` or `sudo dnf clean all`) and your own old backups. Take a [snapshot](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md) before a large clean-up.

## How to check it worked

After a clean-up, run `df -h /` again and compare the `Avail` column. If space doesn't come back after deleting a large file, a program still has it open: restart that program or check `sudo lsof +L1`.

## Frequently asked questions

### Why is my disk smaller than my plan says?

`df -h` shows sizes in GiB (powers of 1024), while disk sizes are often sold in GB (powers of 1000), and the file system reserves some space for itself. If the partition is much smaller than the disk, it may need resizing after an upgrade; see [resize a partition after a disk upgrade](https://help.freakhosting.com/portals/other/how-to-resize-a-partition-after-a-disk-upgrade.md).

### What does the "5% reserved" on ext4 mean?

ext4 keeps about 5% of blocks for root by default, so the system can still work when a normal user fills the disk. That space shows as used in `df`.

### How do I see disk usage in the VPS Panel?

The panel shows your disk size; see [view and manage VPS storage](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md). For what is using space inside the server, use `df` and `du`.

### How do I check the size of a single file?

Use `ls -lh file.tar.gz` or `du -h file.tar.gz`.

## Related guides

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

> [card] [Fix No space left on device](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md)
>
> When the disk is full.

> [card] [Find what is using disk space](https://help.freakhosting.com/portals/other/how-to-find-what-is-using-disk-space-on-linux.md)
>
> Track down large 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] [VPS storage](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md)
>
> Your disks in the VPS Panel.

***

> [!NOTE]
>
> **Checked against the official [GNU Coreutils manual for df and du](https://www.gnu.org/software/coreutils/manual/html_node/Disk-usage.html)** on 4 November 2026; commands tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

> [!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.