Check Raspberry Pi Storage: Commands and What They Show
In this article
- 1. Use df to Check Free Space
- 2. Check the Root Filesystem Directly
- 3. Inspect Disks and Partitions with lsblk
- 4. Find Which Folders Use Space with du
- 5. Use ncdu for an Interactive Breakdown
- 6. Check Mounts with findmnt
- 7. Confirm the Card or Drive’s Actual Capacity
- 8. Check Filesystem and Device Details with fdisk
- 9. Inspect Drive Health Where Supported
- 10. Check Storage Graphically in Raspberry Pi OS
- How to Choose
- Frequently Asked Questions
- Final Thoughts
Checking Raspberry Pi storage helps you find out how much room is left, which filesystem is full, and whether a drive is mounted where you expect. This guide is for Raspberry Pi users working in Raspberry Pi OS or another Linux distribution, whether they need a quick terminal check or want to inspect disks, partitions, and storage health more closely.
1. Use df to Check Free Space
Run df -h in a terminal to see total, used, and available space for mounted filesystems in readable units such as gigabytes. Focus on the Mounted on column: the root filesystem is usually mounted at /, while a boot partition may appear at /boot/firmware on current Raspberry Pi OS releases. A nearly full root filesystem can prevent updates, logs, or applications from writing data even when another drive has plenty of capacity.
2. Check the Root Filesystem Directly
For a focused reading, use df -h /. This reports free space on the filesystem that contains the operating system, rather than listing every mounted temporary or system filesystem. The percentage in the Use% column is useful for spotting pressure, but leave room for package updates, logs, and normal operating-system work instead of waiting until it reaches 100 percent.
3. Inspect Disks and Partitions with lsblk
Run lsblk -o NAME,SIZE,FSTYPE,LABEL,MOUNTPOINTS,MODEL to see block devices, their partitions, filesystem types, labels, mount locations, and often their model names. A microSD card may appear as /dev/mmcblk0, while USB storage commonly appears as /dev/sda; partition names typically add a number, such as /dev/sda1. This view helps distinguish a detected drive from one that is actually mounted and ready to use.
4. Find Which Folders Use Space with du
If df says storage is running low, sudo du -xhd1 / 2>/dev/null summarizes the space used by top-level directories on the root filesystem. The -x option keeps the scan on that filesystem, so a mounted USB drive does not distort the results; -h makes sizes readable. To investigate one directory further, run a similar command on it, such as sudo du -h --max-depth=1 /var, and check large files before deleting anything.
5. Use ncdu for an Interactive Breakdown
ncdu presents directory sizes in a navigable terminal interface, making it easier to find large folders than reading a long du report. Install it with sudo apt update && sudo apt install ncdu, then scan the root filesystem with sudo ncdu -x /. It is especially handy on a headless Pi over SSH, but treat its delete option carefully: removing system files or application data can break services or the operating system.
6. Check Mounts with findmnt
Use findmnt to see how Linux has attached storage devices to the directory tree, including the source device, filesystem, and mount options. To check a particular location, try findmnt / or findmnt /mnt/data; if the latter returns no matching mount, the drive may not be mounted there. This check is useful after connecting a USB drive and when investigating why an application cannot find its expected storage path.
7. Confirm the Card or Drive’s Actual Capacity
lsblk shows the capacity Linux detects, which can be compared with the capacity printed on a microSD card or USB drive. A newly installed operating system may not use every available byte until its root partition is expanded; Raspberry Pi OS normally expands the root filesystem on first boot, but custom images or manual partition changes can differ. Do not assume that a smaller free-space figure means the card is defective: df -h / reports free space, while lsblk reports device and partition sizes.
8. Check Filesystem and Device Details with fdisk
Run sudo fdisk -l to list detected disks and their partition tables, sizes, and partition types. This is useful when a drive appears in lsblk but its partition layout is unclear, or when comparing a card’s full device size with the size assigned to its partitions. Treat this command as a diagnostic tool, not an invitation to change partitions: writing a new partition table or formatting a device can destroy data.
9. Inspect Drive Health Where Supported
For USB hard drives and SSDs that expose SMART data, install the tools with sudo apt install smartmontools and try sudo smartctl -a /dev/sda, replacing the device name with the correct one from lsblk. Some USB-to-SATA adapters do not pass SMART information through, and microSD cards generally do not provide the same health reporting, so a missing report is not proof that a drive is failing. Back up important files before running extended tests or troubleshooting a device that is disconnecting or reporting errors.
10. Check Storage Graphically in Raspberry Pi OS
If you prefer a desktop, open the file manager and inspect the storage locations shown in its sidebar; selecting a mounted drive can show its contents and available capacity. Raspberry Pi OS desktop tools and menus can vary by release, so terminal commands such as df -h remain the most consistent way to verify exact free space. A graphical view is convenient for everyday checks, while lsblk and findmnt provide clearer detail about device names and mount points.
How to Choose
Start with the question you need answered. Use df -h / for free space on the operating system, lsblk to identify devices and partitions, and findmnt to confirm where a device is mounted. If you know a filesystem is full but not why, use du or ncdu to locate large directories; use fdisk -l for partition-layout questions and SMART tools only when the drive and adapter support them.
Be careful to distinguish a device from a partition and from a mounted filesystem. For example, /dev/sda may be a whole USB disk, /dev/sda1 a partition on it, and /mnt/data the directory where that partition is mounted. Before formatting, repartitioning, or deleting files, confirm the device name and make a backup. Capacity readings can also differ because manufacturers label decimal gigabytes while Linux tools may display binary-based units, and because a filesystem reserves some space for its own use.
Frequently Asked Questions
How do I check Raspberry Pi storage from the terminal?
Run df -h for mounted filesystem space. Add lsblk when you also need to identify cards, drives, partitions, and mount points.
Why does my SD card show less space than its label?
Some capacity is used by partitions and filesystem structures, and advertised decimal capacity does not match the units Linux commonly displays. Also check lsblk to see whether the operating system is using the card’s full capacity.
How can I see what is filling up my Raspberry Pi?
Run sudo du -xhd1 / to compare top-level directories, or install ncdu for an interactive view. Avoid deleting unfamiliar system files just because they are large.
Why is my USB drive visible but not usable?
The device may be detected but not mounted, or it may have an unsupported or damaged filesystem. Check lsblk -f and findmnt; do not format it until you have verified that any needed data is backed up.
Does checking storage wear out a microSD card?
Ordinary checks such as df, lsblk, and directory-size scans involve little storage activity. Avoid unnecessary repeated write-heavy tests, and keep a backup because flash cards can fail without providing a reliable health warning.
Final Thoughts
For a quick check, use df -h /; for a fuller picture, combine it with lsblk and findmnt. When space is low, investigate with du or ncdu, and confirm the exact device before making changes that could erase data.