Raspberry Pi online course

Check Disk Space on Raspberry Pi with df

Learn how to use df on Raspberry Pi OS to check filesystem capacity, used space, available space, mounted partitions, and low-storage problems.

Available storage is important on a Raspberry Pi. Operating-system updates, package installations, logs, downloads, databases, and project files all need room on the storage device. When a filesystem becomes full, updates may fail, applications may be unable to write data, and services can behave unpredictably.

This lesson uses the df command from a Raspberry Pi OS terminal. You can work locally or connect through SSH. If you need a terminal introduction, see Terminal in Raspbian or access Raspbian remotely.

What Disk-Space Checks Tell You

A disk-space check measures storage on a filesystem. A filesystem is a formatted storage area organized for files and directories. It may occupy a whole device or only a partition, which is a logical section of a storage device.

Disk space is different from several related measurements:

  • Filesystem capacity is the total storage available to that filesystem.
  • Used space is storage currently occupied by files and filesystem data.
  • Available space is the storage that remains usable for ordinary file creation.
  • RAM usage describes working memory, not persistent SD-card, eMMC, or USB storage. A command such as free is used for memory checks.
  • File or directory size describes how much space particular data consumes. The du command helps locate that data.

The df command answers “How much space is free on each filesystem?” It does not answer “Which directory is using the space?”

The df Command

df is the standard Linux utility for reporting disk-space usage for mounted filesystems. A filesystem is mounted when the operating system makes it accessible through a directory called a mount point. The main Raspberry Pi OS filesystem is normally mounted at /, called the root filesystem.

Run df without options to list mounted filesystems:

df

The default report uses the system's block-based units. A block is a unit used internally by filesystems and by some command-line reports, so the numbers may be less immediately understandable than megabytes or gigabytes.

Running df reports filesystem-level totals. It does not provide a directory-by-directory breakdown of the root filesystem.

Use Human-Readable Output with df -h

The -h option means human-readable. It scales values into convenient units such as K, M, G, and T:

df -h

Typical output looks similar to this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2   29G   11G   17G  40% /
tmpfs            1.0G     0  1.0G   0% /dev/shm
/dev/mmcblk0p1  256M   62M  194M  25% /boot

The exact device names, sizes, filesystem entries, and boot mount point depend on your Raspberry Pi model, operating-system release, storage device, and configuration. Human-readable values are rounded for quick interpretation, so they may not add up exactly when compared manually.

Reading df Output

Each row represents a mounted filesystem or pseudo-filesystem. The root row, identified by the mount point /, is usually the most important row for general Raspberry Pi storage questions.

ColumnWhat it identifiesHow a Raspberry Pi user should interpret it
Filesystem or deviceThe source providing the filesystemThis may be an SD-card partition such as /dev/mmcblk0p2, a USB-storage device, or a virtual filesystem.
Total sizeThe filesystem's capacityThe total space available to that mounted filesystem, shown as Size when using -h.
Used sizeOccupied storageSpace already consumed by files and filesystem data.
Available sizeRemaining usable storageThe practical space available for ordinary users and applications to create files.
Use percentageThe proportion occupiedA value such as 40% means approximately 40 percent of the filesystem is in use.
Mounted onThe mount pointThe directory where the filesystem is accessible, such as /, /home, or /boot.

Important filesystem entries

Entry typeTypical purposeWhether it usually reflects persistent SD-card or USB capacity
Root filesystemContains the operating system and usually most user data; mounted at /.Yes. This is normally the main persistent storage volume.
Boot filesystemContains boot-related files and may be mounted at /boot or another boot path.Yes, when it is a separate partition, but it has its own capacity limit.
tmpfsA temporary filesystem backed by memory and used for runtime data.Usually no. It consumes RAM or swap-related resources rather than persistent SD-card space in the same way as the root filesystem.
devtmpfsA system-managed filesystem containing device entries.Usually no. It is a virtual system mount.
Mounted USB drive or network filesystemAdditional local storage or storage supplied by another machine.It reflects that device or network filesystem, not necessarily the Raspberry Pi's SD card.

Entries such as tmpfs, devtmpfs, and other system mounts can make the output look crowded. They do not represent SD-card capacity in the same way as the root filesystem row.

Check One Filesystem or Path

Pass a path to df when you want to identify the filesystem containing that path. This is useful when several partitions or mounts exist, because each filesystem has an independent capacity and available-space limit.

df -h /
df -h /home
df -h ~

df -h / reports the filesystem containing the operating-system root directory. df -h /home reports the filesystem containing the home-directory path. df -h ~ checks the current user's home directory; the shell expands ~ to that directory before running the command.

If /home is not a separate mount, its result will normally be the same filesystem as /. If you placed home directories on another partition or USB drive, it can report a different filesystem and different available space.

Check the boot filesystem

Some Raspberry Pi OS installations use a separate boot partition. Its mount location can differ between releases and setups. Common locations include /boot and a boot-related path below /boot, but do not assume one location applies to every system.

df -h /boot

If that path is not the boot mount point on your system, inspect the mounts with mount or findmnt, then run df -h against the path shown for the boot filesystem.

Useful df Options

CommandPurposeWhen to use it
dfDisplay mounted-filesystem usage using default block units.When you need the standard report or exact command output for diagnosis.
df -hDisplay sizes in human-readable units.For a quick overview of storage in K, M, or G units.
df -h /Report the filesystem containing the root directory.To focus on the main operating-system storage volume.
df -h ~Report the filesystem containing the current user's home directory.To check where user files are stored.
df -T -hShow human-readable usage together with filesystem types.When filesystem types help distinguish persistent storage from virtual mounts.
df -iReport inode usage.When a program says there is no space but df -h still shows capacity.

What Low Disk Space Means

A filesystem close to full can cause failed updates, failed package installations, failed writes, application errors, incomplete downloads, and service or boot problems. These problems may appear before the displayed capacity reaches exactly 100 percent.

As a practical warning, investigate sustained usage above roughly 80–90 percent, especially on a small root filesystem. These are warning levels, not universal rules: a system's workload, database size, logging rate, and maintenance schedule determine how much free space it needs. Avoid waiting until a filesystem is completely full.

The Available value can be lower than a simple calculation of total size minus used size. Filesystem metadata, rounding, and blocks reserved for administrative use can account for differences. On some filesystems, reserved blocks help the system recover from a nearly full condition and may not be available to ordinary users. Treat Avail as the practical amount available to the current user.

When df Finds a Full Filesystem

Use df to identify which filesystem is full, then use du to estimate which directories and files consume space. These commands answer different questions:

  • df reports capacity, used space, and available space for mounted filesystems.
  • du estimates space used by directories and files.

For example, to inspect the current user's home directory:

du -sh ~

To list the largest top-level directories on the root filesystem without crossing into other mounted filesystems, run:

sudo du -xhd1 / 2>/dev/null | sort -h

The -x option keeps the scan on the same filesystem as /`. The -d1 option limits the report to one directory level, and sort -h sorts human-readable sizes. Permission errors are redirected away with 2>/dev/null.

Review the results before removing anything. Safer cleanup categories can include unneeded downloads, old logs that are no longer required, unused packages, package caches, and temporary project artifacts. Do not delete system files indiscriminately: removing files from directories such as /usr, /etc, or application data locations can damage the operating system or services.

Troubleshooting df Results

The report contains many entries

This usually happens because Linux reports virtual filesystems and system-managed mounts in addition to persistent storage. Find the row mounted on /, or narrow the report:

df -h /

Use filesystem types for additional context:

df -T -h

The root filesystem is nearly full

  1. Confirm the affected filesystem with df -h /.
  2. Use sudo du -xhd1 / 2>/dev/null | sort -h to find large top-level directories on that filesystem.
  3. Inspect the files and remove only data known to be unnecessary.

Common causes include operating-system updates, logs, downloads, package caches, databases, and application or project data.

The boot area is full but the root filesystem has space

A separate boot partition has its own smaller capacity. Check the actual boot mount path with mount or findmnt, then run df -h against that path. Remove only obsolete or intentionally duplicated boot-related files after confirming their purpose.

A program says “No space left on device”

The application may be writing to a different mount than the one you checked. Check the exact path used by the program:

df -h /path/used/by/the/application

If capacity is available, check inode usage:

df -i

A filesystem can run out of inodes when it contains very large numbers of small files, even though it still has free capacity. Another possibility is a deleted file that a running process still has open; investigating that case may require administrative process and file-descriptor tools.

Available space does not equal total minus used

Use the Available column as the practical answer. Rounding, filesystem metadata, reserved blocks, and different display units can make the visible arithmetic differ.

Quick Reference

# List mounted filesystems
 df

# Use readable units
 df -h

# Check the root filesystem
 df -h /

# Check the current user's home filesystem
 df -h ~

# Show filesystem types
 df -T -h

# Check inode availability
 df -i

# Estimate home-directory usage
 du -sh ~

For related command-line practice, see Useful Terminal Commands, Directory Management, and File Management. If a larger SD card was installed but the root filesystem does not use all of it, see Expand Raspbian Filesystem.