Check Disk Space in Linux with df
Learn how to use the Linux df command to check filesystem capacity, used and available space, mount points, filesystem types, and inode usage.
The df command reports free and used space on mounted filesystems. It helps you answer questions such as: Which filesystem is nearly full? How much space is available? Where is a filesystem mounted? Are inodes exhausted?
df reports filesystem-level usage, not the size of individual directories or files. After df identifies a full filesystem, use du to find which directories and files consume the space.
What df Reports
A filesystem is a formatted storage structure that holds files and directories. A filesystem can be stored on a disk partition, but it can also be provided by a network service, a memory-backed filesystem, a container, or the Linux kernel.
A mount point is a directory through which a filesystem is accessed. For example, one filesystem might be mounted at /, another at /home, and a removable drive at /media/USER/DRIVE_LABEL.
Unlike du, which measures data beneath directories, df shows the total capacity, allocated capacity, available capacity, usage percentage, and mount location for filesystems.
Run the Basic df Command
df
With no options, df displays normally reported mounted filesystems. The exact rows depend on the host and its mounts. Default values may be shown as counts of 1K blocks, depending on the environment and options, so the output can be difficult to read at a glance.
Read df Output
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/nvme0n1p2 102400000 42000000 60300000 42% /
/dev/nvme0n1p3 204800000 95000000 109000000 47% /home
tmpfs 800000 0 800000 0% /run/user/1000
| Column | Meaning | How to use it |
|---|---|---|
| Filesystem | The device, virtual filesystem, or other storage source backing the mount. | Identify what supplies the storage. A name such as /dev/nvme0n1p2 is a device file representing a partition; other rows may be network, temporary, loop, container, or pseudo-filesystems. |
| Size | Total filesystem capacity. | Compare the filesystem's total capacity with its used and available values. |
| Used | Allocated or consumed filesystem capacity. | Use it with Use% to identify storage pressure. |
| Avail | Capacity available to ordinary users. | Use this value when deciding whether a normal process can create more files. |
| Use% | Percentage of capacity in use. | Look for high values such as 90% or 100% when investigating failures. |
| Mounted on | The directory where the filesystem is attached to the Linux directory tree. | Use the mount point to determine which part of the directory tree is affected. |
The Filesystem column does not always name a physical disk partition. Entries such as tmpfs, proc, devpts, and sysfs are virtual or kernel-managed filesystems. Network mounts such as nfs also appear as mounted filesystems.
Use Human-Readable Sizes
df -h
The -h option displays convenient scaled units such as MiB, GiB, or TiB. This is usually the best interactive view because values are easier to interpret than raw block counts.
df -H
The -H option also uses readable units, but uses decimal scaling: powers of 1000 rather than the binary-style scaling commonly associated with -h. For routine inspection, df -h is usually sufficient.
Check the Filesystem Containing a Path
df accepts one or more file or directory paths. It reports the filesystem on which each supplied path resides.
df -h /home
df -h /
df -h /var
df -h /path/to/file-or-directory
df -h /media/USER/DRIVE_LABEL
Use this technique to check a home directory, application data directory, root directory, or mounted removable drive before copying or generating data.
A directory can be on a separate mounted filesystem from its parent. For example, /home may be its own filesystem even though it appears beneath /. If /home is not separately mounted, df -h /home reports the root filesystem instead.
findmnt -T /home
findmnt -T PATH shows the mount and source associated with a path, which is useful when the mount relationship is unclear.
Filter by Filesystem Type
A filesystem type identifies the filesystem format or mount implementation. Common types include ext4, xfs, btrfs, tmpfs, and nfs. The types available depend on the host and its mounted storage.
df -h -t ext4
df -h -t xfs
df -h -t btrfs
df -h -t tmpfs
df -h -t nfs
The -t TYPE option limits the report to filesystems of the requested type. Filtering can make a report easier to scan when many virtual or network mounts are present.
Check Inode Availability
An inode is filesystem metadata representing a file or directory. It records attributes such as ownership and permissions and references the blocks containing the file's data. Each file and directory consumes an inode.
df -i
Typical inode output includes these fields:
- Inodes: Total inode capacity.
- IUsed: Inodes currently allocated to files and directories.
- IFree: Unallocated inodes.
- IUse%: Percentage of inodes in use.
- Mounted on: The mount point for the filesystem.
A filesystem can have free byte capacity but no free inodes. This often happens when an application creates an exceptionally large number of small files. The result can be a “No space left on device” error even though df -h shows available gigabytes.
df -h
df -i
When byte capacity looks healthy but file creation fails, inspect IUse% with df -i.
Include All Filesystem Entries
df -a
The -a option includes filesystem entries that are normally omitted. It can reveal pseudo-filesystems such as proc, devpts, and sysfs, along with entries that have zero or otherwise nonstandard capacity.
This output can be noisy and is not usually the best first view for physical storage capacity. Use df -h for a practical overview and df -a when complete mount enumeration is needed.
Common df Options
| Option | Purpose | Example |
|---|---|---|
-h | Use human-readable scaled units. | df -h |
-H | Use human-readable decimal unit scaling. | df -H |
-t TYPE | Show only a requested filesystem type. | df -h -t ext4 |
-i | Show inode totals and usage. | df -i |
-a | Include normally omitted filesystem entries. | df -a |
PATH | Report the filesystem containing a file or directory. | df -h /home |
Interpret Storage Warnings
A high Use% value can cause application failures, unsuccessful package updates, failed log writes, and an inability to create temporary files. Start with:
df -h
Find the mount point with high usage, then inspect directories beneath that mount point. For example:
df -h /var
du -sh /var
df measures allocated filesystem blocks, while du estimates data visible beneath a directory. Their values do not necessarily match. One reason is a deleted file that is still open: its directory entry is gone, but a running process continues to hold its allocated blocks. Reserved blocks can also affect the result.
Reserved blocks are filesystem capacity set aside for privileged users or filesystem maintenance. Consequently, Avail for ordinary users can be lower than a simple Size minus Used calculation suggests. Treat Avail as the relevant value for normal file creation.
Choose the Correct Tool
| Symptom | Likely issue | Command to run next |
|---|---|---|
Filesystem has high Use%. | Allocated byte capacity is nearly exhausted. | df -h, then du -sh /path on directories in the affected mount. |
| Cannot create files although capacity appears available. | Inodes may be exhausted, or deleted files may still be open. | df -i; if inode use is normal, investigate open deleted files. |
| Need to know which filesystem contains a directory. | The directory may be on a separate mount or on the root filesystem. | df -h /path or findmnt -T /path. |
| Need to identify large directories after locating a full filesystem. | Filesystem-level usage has been located, but the consuming data is unknown. | du -sh /path. |
| Need to inspect virtual or omitted mounts. | Normal output excludes some filesystem entries. | df -a. |
In short, df answers which mounted filesystem is full? Use du to answer which directory or file is using the space? Use lsblk, findmnt, or mount to inspect devices and mount relationships.
Troubleshooting Examples
A filesystem is near 100% usage
- Run
df -hand identify the affected mount point. - Use
du -shon top-level directories within that mount point. - Check logs, caches, temporary files, backups, and application data.
- Do not delete unfamiliar system files solely because they are large.
No space left on device despite free capacity
- Run
df -iand inspectIUse%. - If inode usage is high, look for workloads that create many small files.
- If inode usage is normal, compare
dfandduand investigate deleted files still held open by running processes.
A separate /home or /var filesystem is not visible
df -h /home
df -h /var
findmnt -T /home
findmnt -T /var
The directory may simply be part of the root filesystem rather than a separate partition or mount. Remember that a partition is only a logical subdivision of a storage device; not every filesystem corresponds to a conventional physical partition.
Virtual entries make df confusing
Entries such as tmpfs, proc, and devpts are virtual or memory-backed mounts. Use df -h for the normal overview, filter with -t TYPE when appropriate, and reserve df -a for complete visibility.
Quick Reference
# Normal filesystem report in readable units
df -h
# Check the filesystem containing a path
df -h /home
# Filter by filesystem type
df -h -t ext4
# Check inode capacity
df -i
# Include normally omitted entries
df -a
# Compare filesystem and directory-level usage
df -h /var && du -sh /var
For more Linux storage guidance, return to the disk space check reference.