Blog

Wie Sie den Speicherplatz auf dem Raspberry Pi überprüfen

0
Wie Sie den Speicherplatz auf dem Raspberry Pi überprüfen

The Raspberry Pi is still one of the most widely used single-board computers in 2026. People run everything on it—Pi-hole ad blockers, Home Assistant servers, RetroPie gaming setups, Jellyfin or Kodi media centers, and even lightweight AI experiments on newer models like the Pi 5 and Pi 500. No matter the use case, storage space becomes a problem sooner than expected.

Most Raspberry Pi systems still boot from microSD cards, typically between 32 GB and 256 GB. At the same time, USB-connected SSD and NVMe booting has become increasingly popular thanks to better USB performance and official bootloader support. While larger storage is now common, it also fills up fast.

A clean Raspberry Pi OS installation does not look large at first. The Lite version usually takes around 4–8 GB, while the Desktop edition with Chromium and LibreOffice installed consumes roughly 8–12 GB. In real-world use, however, disk usage grows quickly. System logs, package caches, Docker containers, downloaded media, and temporary files from regular updates can push usage past 20 or even 50 GB within weeks.

Once storage runs low, problems follow. Package installations fail with “No space left on device” errors. Docker image pulls break because the root filesystem is full. Systems become unstable when disk usage approaches 100 percent. On microSD cards, running near full capacity also accelerates wear and increases the risk of corruption.

These issues are common because disk usage is rarely monitored. Filesystems are not always expanded after flashing an image. Logs and Docker data grow without limits. Long-running services that write frequently make the situation worse over time.

Knowing how to check disk space is therefore essential for any Raspberry Pi project. This guide shows you simple terminal commands for quick checks, ways to find exactly what is using your storage, and practical methods to keep disk usage under control. Whether you are running a media server or a headless sensor node, these skills will help keep your Raspberry Pi stable and reliable.

Basic & Essential Commands: df and lsblk

The fastest way to check disk space on a Raspberry Pi is with two built-in commands: df and lsblk. They require no additional packages and provide an immediate, high-level view of your storage situation.

Open a terminal (via SSH, directly on the desktop, or through a remote session) and start with the most commonly used command.

Check overall disk usage with df

				
					df -h
				
			

The -h option displays sizes in a human-readable format (GB, MB instead of raw bytes).

Below is a typical output from a Raspberry Pi 5 running Raspberry Pi OS (Trixie), using a 64 GB microSD card and an attached USB SSD:

				
					Filesystem      Size  Used Avail Use% Mounted on
/dev/root        59G   12G   45G  21% /
/dev/mmcblk0p1  512M  128M  384M  25% /boot/firmware
/dev/sda1       931G  250G  681G  27% /media/pi/SSD
tmpfs            3.8G     0  3.8G   0% /dev/shm
tmpfs            1.6G  1.2M  1.6G   1% /run
tmpfs            5.0M     0  5.0M   0% /run/lock
				
			

Key columns to understand

  • Filesystem: The device or partition. (/dev/root represents the main root filesystem, whether it lives on a microSD card or an SSD.)
  • Size: Total capacity of the filesystem.
  • Used: Space currently in use.
  • Avail: Space available for new data.
  • Use%:Percentage of space used. (Try to keep this below 85–90%, especially on microSD cards.)
  • Mounted on: Where the filesystem appears in the directory tree. (/ is the root filesystem; /boot/firmware contains boot-related files on Trixie and later releases.)

On Trixie (and late Bookworm releases), the root filesystem often appears as /dev/root rather than a direct device name such as /dev/mmcblk0p2. This is normal—it is a symlink to the actual partition.

If you only care about the main filesystem (which is usually the one that fills up first), you can target it directly:

				
					df -h /
				
			

From any directory, you can also check which filesystem that path belongs to:

				
					df -h .
				
			

Identify disks and partitions with lsblk

While df shows usage, lsblk shows what storage devices exist and how they are laid out.

				
					lsblk -f
				
			

Example output on a Raspberry Pi booting from NVMe (a common setup on Pi 5 and Pi 500 systems):

				
					NAME        FSTYPE SIZE MOUNTPOINTS
mmcblk0            119.1G
├─mmcblk0p1 vfat    512M /boot/firmware
nvme0n1            238.5G
├─nvme0n1p1 ext4    200G /
└─nvme0n1p2 ext4     38G /home
sda                931G
└─sda1     exfat    931G /media/pi/External
				
			

This output clearly shows:

  • Devices (mmcblk0 = microSD, nvme0n1 = NVMe SSD, sda = USB drive)
  • Partitions on each device
  • Filesystem types (ext4, vfat, exfat)
  • Mount points

Use lsblk whenever you attach new storage, switch to SSD or NVMe booting, or want to confirm that a drive is mounted where you expect.

Live monitoring during heavy activity

For long-running tasks such as downloads, backups, or Docker builds, it can be useful to watch disk usage change in real time:

				
					watch -n 5 df -h /
				
			

This refreshes the output every five seconds and lets you see the Use% increase as data is written.

When should you worry?

If the root filesystem exceeds 90% usage, especially on a microSD card, you should act quickly. High disk usage accelerates wear, increases the risk of write errors, and can trigger “No space left on device” failures—even when df still shows a few gigabytes free. Reserved blocks and inode exhaustion can cause issues before a disk is technically full.

Finding What’s Using Space: du, Advanced du Tricks, and Identifying Culprits

Commands like df and lsblk show how much disk space is used, but they do not explain what is using it. To identify the real space hogs, you need du.

The du command estimates disk usage for directories and files, allowing you to drill down until you find the largest consumers.

Start with your home directory

A quick first step is to check the top-level folders in your home directory:

				
					du -sh ~/*
				
			

This lists the size of each item under your home directory (for example, Downloads, Documents, .cache).

The -s option summarizes each directory, and -h keeps the output human-readable.

On desktop installations, this often reveals large browser caches, downloaded media, or leftover project files.

Scan the root filesystem for large directories

To get a broader picture, scan the root filesystem and sort directories by size. Some paths require root access, so use sudo:

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

What this command does:

  • Scans the root filesystem (/)
  • Limits output to the first directory level (–max-depth=1)
  • Sorts results by size, largest first (sort -hr)
  • Shows only the top 15 entries

Typical output on a Raspberry Pi might look like this:

				
					55G   /media
2.5G  /usr
800M  /var
300M  /opt
200M  /home
				
			

Large values under /media are common if you mount external drives or store videos and photos there.

On many Raspberry Pi systems, especially in 2026 setups, /var is a frequent culprit due to logs and container data.

Common problem areas to check

Once you identify a suspicious directory, focus on these common sources of disk growth.

System logs and journald

On recent Raspberry Pi OS releases (Trixie and later), systemd-journald defaults to volatile storage in RAM. If persistent logging is enabled, logs accumulate under /var/log/journal.

Check current log usage with:

				
					journalctl --disk-usage
				
			

Persistent logs can easily grow to hundreds of megabytes if services are noisy or repeatedly error.

Docker data

If you run Docker containers (common for Home Assistant, Pi-hole add-ons, or media servers), Docker storage is often the largest space consumer.

Check Docker disk usage with:

				
					docker system df
				
			

By default, container logs stored in /var/lib/docker/containers/*-json.log grow without limits unless log rotation is configured. Overlay storage (overlay2) can reach tens of gigabytes over time.

APT package cache

Downloaded package files accumulate after updates and upgrades:

				
					sudo du -sh /var/cache/apt
				
			

This directory is safe to clean once packages are installed.

Finding large files anywhere

To locate individual files larger than 100 MB across the system:

				
					sudo find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -hr | head -n 10
				
			

Redirecting errors to /dev/null avoids clutter from permission-denied messages in system directories.

Typical disk space hogs on Raspberry Pi

In real-world Raspberry Pi setups, the biggest offenders are usually:

  • Unpruned Docker images, containers, and volumes
  • Browser caches under ~/.cache (especially Chromium on desktop systems)
  • Downloaded media, backups, or test data in /home/pi
  • Log files, temporary update data, and old packages under /var

Run du scans regularly after large updates, container changes, or new projects. Once you know what is consuming space, the next section introduces interactive and visual tools that make exploration and cleanup faster and safer.

Interactive and Visual Tools: ncdu, GUI Analyzers, and Beyond

After using du to identify large directories, interactive tools make exploration and cleanup much easier. They turn raw numbers into something navigable, which is especially useful over SSH or on resource-limited Raspberry Pi systems.

ncdu: the most practical tool for most users

For most Raspberry Pi users in 2026, the standout tool is ncdu (NCurses Disk Usage). It provides a fast, text-based interface that you can navigate with the keyboard, even on headless systems. It uses very little CPU and memory and allows you to delete files directly from the terminal.

Install it from the default Raspberry Pi OS (Trixie) repositories:

				
					sudo apt update
sudo apt install ncdu
				
			

To analyze the entire root filesystem:

				
					sudo ncdu -x /
				
			

The -x option keeps the scan within the current filesystem and skips mounted external drives. This avoids long scans of large USB or network storage.

Once ncdu starts:

  • Use the arrow keys to navigate
  • Press Enter or the right arrow to open a directory
  • Press d to mark a file or directory for deletion (confirm with y)
  • Press ? to view the full help menu
  • Press q to quit

ncdu is excellent for uncovering hidden space hogs, such as Docker data under /var/lib/docker, accumulated logs in /var/log, or large caches in ~/.cache. For many Raspberry Pi users, it is the fastest way to clean up disk space without installing a full desktop environment.

GUI option: Disk Usage Analyzer (Baobab)

If you are running the full Desktop edition of Raspberry Pi OS (XFCE on Trixie), you can use the built-in Disk Usage Analyzer (package name: baobab).

Install it if necessary:

				
					sudo apt install baobab
				
			

Launch it from the application menu

System Tools → Disk Usage Analyzer, or start it from the terminal:

				
					baobab
				
			

The tool prompts you to scan your home directory or the entire filesystem. Scanning the root filesystem (/) gives the most complete view.

Baobab provides:

  • A ring chart showing directory sizes (inner rings are top-level folders)
  • A treemap or list view with proportional sizing
  • Click-to-zoom navigation and right-click options to delete or move files

This visual approach helps newer users quickly spot patterns, such as /var dominating due to logs or container data.

Beyond one-off checks: long-term monitoring

For always-on projects like media servers or Home Assistant systems, consider long-term monitoring instead of manual checks. A common setup uses metrics collection (for example, Telegraf or node exporters) combined with dashboards in Grafana to visualize disk usage trends over time.

This approach goes beyond basic troubleshooting, but it helps catch slow, steady growth before disk space becomes a problem.

Tool comparison

WerkzeugTypBest forDesktop requiredDelete files
df / duCLI (basic)Quick overviews and scansNeinNein
ncduCLI (interactive)Deep exploration and cleanupNeinJa
BaobabGUIVisual analysis and learningJaJa
Grafana stackWeb dashboardOngoing monitoring over timeNo (browser)Nein

These tools bridge the gap between basic checks and hands-on disk management. For most situations, ncdu is the best first choice. If you prefer visual feedback, Baobab is a solid alternative.

Prevention, Cleanup, Automation, and Best Practices

Checking disk space is reactive. Preventing disk space issues is proactive.

In 2026, many Raspberry Pi systems—especially Pi 5 and Pi 500 setups booting from SSD or NVMe—have much larger storage than older microSD-based builds. That extra space often leads users to ignore maintenance until something breaks. A few simple habits can keep long-running projects stable and predictable.

Always expand the filesystem after imaging

After flashing Raspberry Pi OS to a larger microSD card or SSD, unused space is not always allocated automatically. Make sure the filesystem is expanded:

				
					sudo raspi-config
				
			

Navigate to Advanced Options → Expand Filesystem, then reboot.

This step ensures the operating system can use the full capacity of the drive.

Perform regular cleanup

Light, routine cleanup prevents sudden failures. Running these steps weekly or monthly is usually sufficient.

APT package cleanup

Remove unused packages and cached installation files:

				
					sudo apt update
sudo apt autoremove
sudo apt clean
				
			

This safely clears /var/cache/apt and removes obsolete dependencies.

System logs (journald)

On Raspberry Pi OS based on Bookworm and Trixie, systemd-journald defaults to volatile storage (RAM). Logs are cleared on reboot unless persistent logging is explicitly enabled.

Check current log usage:

				
					journalctl --disk-usage
				
			

If you enable persistent logging and want to limit growth, edit:

				
					/etc/systemd/journald.conf
				
			

Uncomment and set:

				
					Storage=persistent
RuntimeMaxUse=100M
				
			

Then restart journald:

				
					sudo systemctl restart systemd-journald
				
			

This caps log usage and prevents silent growth under /var/log/journal.

Docker-specific maintenance

For Raspberry Pi users running Docker (Home Assistant, Pi-hole, media servers), Docker storage is often the largest disk consumer.

To remove unused containers, images, networks, and volumes:

				
					docker system prune -a --volumes
				
			

⚠️ This deletes all unused Docker data. Do not run it if you rely on stopped containers or unused images.

To avoid runaway container logs, configure log rotation in daemon.json or docker-compose.yml:

				
					"log-driver": "json-file",
"log-opts": {
  "max-size": "50m",
  "max-file": "5"
}
				
			

Restart Docker after applying changes.

Prefer SSD or NVMe booting

Booting from SSD or NVMe on supported models (Pi 5 and Pi 500) provides:

  • Faster I/O performance
  • No microSD wear from constant writes
  • Easier management of larger storage

You can flash Raspberry Pi OS directly to NVMe using Raspberry Pi Imager.
Set boot order via:

raspi-config → Advanced Options → Boot Order → NVMe/USB first

Automate disk usage alerts

Automation helps catch problems early. A simple daily disk check can prevent surprises.

Create a script:

				
					nano /home/pi/check_disk.sh
				
			
				
					#!/bin/bash

USAGE=$(df -h / | awk 'NR==2 {gsub("%","",$5); print $5}')

if [ "$USAGE" -gt 85 ]; then
  echo "Disk usage warning: ${USAGE}%" \
  | mail -s "Raspberry Pi Disk Alert" your@email.com
fi
				
			

Make it executable:

				
					chmod +x /home/pi/check_disk.sh
				
			

Add it to cron:

				
					crontab -e
				
			

Run daily at 3 AM:

				
					0 3 * * * /home/pi/check_disk.sh
				
			

For advanced monitoring, metrics-based solutions such as Telegraf with Grafana dashboards can visualize disk usage trends over time.

Troubleshooting tips

df shows less space than expected

Ensure the filesystem is expanded. On ext4 systems, also check reserved blocks:

				
					sudo tune2fs -l /dev/root | grep "Reserved block count"
				
			

Docker fills disk silently

Always prune after experiments and enable log rotation.

Abschließende Gedanken

Use df -h for quick checks.

Use du and ncdu to identify real space consumers.

Use visual tools when they help you see patterns faster.

Apply preventive limits and simple automation for long-term stability.

Five minutes of regular maintenance can keep a Raspberry Pi reliable for months—whether it is running a home automation system, a media server, or a remote sensor node.

If your Raspberry Pi project is more than a personal experiment—and you are thinking about turning a prototype into real hardware—PCBCool can help. We are an EMS provider serving both businesses and individual makers, with no minimum order quantity. From PCB fabrication and assembly to small-batch production, we help turn ideas into working products—without the barriers that usually come with manufacturing.

Häufig gestellte Fragen (FAQ)

Q1: Why Does My Raspberry Pi Run Out Of Disk Space So Quickly?

A: Logs, container data, caches, and temporary files grow continuously on always-on systems.

Q2: How Much Free Space Should I Keep On The Root Filesystem?

A: At least 10–15% free space is recommended for stable operation.

Q3: Why Does df Show Free Space But Writes Still Fail?

A: Reserved blocks or inode exhaustion can cause failures before the disk is fully used.

Q4: Is Running Near Full Disk Dangerous For microSD Cards?

A: Yes. It increases wear, slows writes, and raises the risk of corruption.

Q5: Does Booting From SSD Or NVMe Reduce Disk Space Issues?

A: It improves reliability and performance but does not prevent uncontrolled disk growth.

Q6: Do Docker Containers Consume Disk Space When Stopped?

A: Yes. Images, volumes, and logs remain until explicitly removed.

Q7: Can Browser Caches Cause Disk Space Problems On Desktop Systems?

A: Yes. Chromium caches can grow several gigabytes over time.

Q8: Why Is My External Drive Full Even Though The Root Disk Looks Fine?

A: Mounted storage under /media is separate from the root filesystem.

Q9: Does Raspberry Pi OS Automatically Expand The Filesystem?

A: Not always. Manual expansion is sometimes required after imaging.

Q10: Are Log Files Cleared Automatically On Reboot?

A: Only if journald is configured for volatile storage.

Q11: Why Does Disk Usage Increase After Every Update?

A: Package caches, old dependencies, and temporary files are retained unless cleaned.

Q12: Can Too Many Small Files Fill A Disk Without Large Files?

A: Yes. Inode limits can be reached even when space appears available.

Q13: Is It Safe To Delete Files From /var/log?

A: Yes, if the files are not actively used by running services.

Q14: Should I Store Databases On The Root Filesystem?

A: It is better to place write-heavy data on SSD or external storage.

Q15: Can Old Kernels Accumulate On Raspberry Pi OS?

A: Rarely, but leftover packages may remain after upgrades.

Q16: Why Does Disk Usage Grow Even When I Do Not Add Files?

A: Background services, logs, and scheduled tasks write continuously.

Q17: Can Network Shares Cause Disk Usage Confusion?

A: Yes. Mounted network storage may hide local disk limits.

Q18: Is It Safe To Use The Same Disk For OS And Data?

A: Yes for light use, but separation improves stability on heavy workloads.

Q19: Why Does df Output Change After Reboot?

A: Temporary filesystems and volatile logs are cleared at startup.

Loki
Loki | Spezialist für internationalen Handel und Leiterplattenfertigung

Loki ist seit 2021 im internationalen Handel und in der Leiterplattenfertigung tätig und verfügt über Erfahrung in der Leiterplattenherstellung, Montage und Kundenkommunikation. Bei PCBCool unterstützt er die Veröffentlichung technischer Inhalte und hilft, Kundenanfragen mit dem zuständigen Account Manager zu verbinden, um eine effiziente Projektverfolgung zu gewährleisten.

Verwandte Schlagwörter