How to Check Disk Space in Linux with df
Learn how to use Linux df to inspect filesystem capacity, used and available space, mount points, filesystem types, and inode usage.
The df command reports free and used space for mounted filesystems. It helps you determine whether a filesystem is running out of capacity, which mount point is affected, and whether the problem concerns data blocks or inodes.
This lesson assumes basic command-line navigation, Linux directory paths, and a general understanding of storage devices, filesystems, and mount points. For shell fundamentals, see Bourne Again Shell Bash.
What the df Command Reports
A filesystem is a formatted storage structure that organizes files and directories, such as ext4 or xfs. A filesystem may be stored on a partition, logical volume, removable device, network storage, or another kind of backing storage.
A mount point is the directory where Linux makes a filesystem available in the directory tree. For example, a separate filesystem might be mounted at /home. Files accessed below /home then reside on that filesystem rather than necessarily using the root filesystem.
Running df without options reports the mounted filesystems visible to the system, normally omitting some virtual or zero-block entries.
dfdf reports space at the filesystem level. It does not tell you how much space one directory or file consumes. Use a directory-size tool such as du when you need to locate large content inside an affected mount point.
Reading Default df Output
A typical result resembles the following. Exact device names, sizes, and units vary by system.
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 10240000 5242880 4997120 52% /
/dev/sda3 20480000 7340032 13139968 36% /homeThe default unit is often 1K blocks, depending on the implementation and environment. This is precise for command output but less convenient to read mentally than gigabytes or terabytes.
Mount points are especially important when diagnosing space problems. The rows for /, /home, and /var may refer to different filesystems, each with independent capacity.
Use Human-Readable Units with df -h
The -h option displays sizes with readable suffixes such as K, M, G, and T.
df -hInstead of comparing large block counts, you may see output similar to this:
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.8G 5.0G 4.8G 52% /
/dev/sda3 20G 7.1G 13G 36% /homedf -h is usually the preferred form for interactive inspection. Use the Use% column to find heavily used filesystems, then use Mounted on to identify where that filesystem is attached.
Useful df Options
Filter by Filesystem Type
The -t option filters the result by filesystem type. For example, to view mounted ext4 filesystems only:
df -t ext4Replace ext4 with the type you need. Common types include:
ext4— A widely used Linux filesystem.xfs— A high-performance filesystem commonly used on Linux servers.btrfs— A filesystem with features such as snapshots and checksums.tmpfs— A temporary filesystem generally backed by memory or swap.vfat— Commonly used for firmware and removable-media partitions.nfs— A network filesystem.
Filtering is useful when a machine has many mounts and you want to focus on one storage class, such as local ext4 filesystems or network-mounted nfs filesystems.
Check Inode Usage with df -i
An inode is a filesystem metadata structure representing a file or directory. It tracks attributes and the locations of the file's data blocks. Every file and directory requires an inode.
df -iThe output includes inode totals, used inodes, available inodes, and inode usage percentage. The exact headings may differ slightly between implementations, but the key value is the inode Use%.
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda2 655360 654900 460 100% /
/dev/sda3 1310720 120000 1190720 9% /homeA filesystem can have free byte capacity while having no free inodes. In that situation, it cannot create more files or directories even though df -h appears to show available space. Workloads that create many small files, such as caches, mail queues, temporary data, or build trees, are common causes of inode exhaustion.
Show All Filesystem Entries with df -a
The -a option includes filesystem entries that are normally omitted, including pseudo-filesystems and entries with zero blocks.
df -aA pseudo-filesystem is a virtual filesystem supplied by the kernel or system runtime rather than ordinary disk-backed storage. Examples include procfs, commonly visible at /proc, and devpts, commonly associated with pseudo-terminals under /dev/pts.
Entries under /proc, /sys, and /dev can appear when using -a. They generally do not represent ordinary persistent disk capacity, so do not treat every row as a physical disk or partition.
Check the Filesystem for a Specific Path
Supply one or more files or directories as arguments to ask which filesystem contains them.
df /homeThis reports the filesystem on which /home resides. It can show whether /home is a separate mount point or simply a directory within the root filesystem.
You can check several paths in one command:
df -h / /home /varMultiple paths may resolve to the same filesystem. They may also resolve to different filesystems if separate mounts are attached below those directories. This matters because a full /var filesystem does not necessarily mean that the root filesystem or /home filesystem is full.
Understand Disk-Full Conditions
Start with:
df -hLook for a high value in Use%. The Mounted on column identifies the affected filesystem. For a particular path, use:
df -h /path/to/checkLow available blocks and zero available inodes are different conditions:
Available space shown to non-root users can differ from total free capacity because some filesystems reserve blocks for privileged system use. Reserved blocks can allow essential system processes to continue operating even when ordinary users see little or no available space.
Remember that df reports filesystem allocation. It does not identify which individual directory tree consumed the space, and its totals may not correspond directly to the apparent sizes of files in a directory.
Practical Troubleshooting
A filesystem is nearly full
- Run
df -h. - Find the row with a high
Use%value. - Read the
Mounted oncolumn to identify the affected mount point. - Use
duwithin that mount point to locate large directories or files.
File creation fails despite free space
- Run
df -i, or check the affected path directly withdf -i /path. - Look for an inode usage value of 100%.
- Search for workloads creating excessive numbers of small files.
- Remove unnecessary files or consolidate them, then verify inode availability again.
The space for /home does not match the root report
- Run
df -h /home. - Compare the reported filesystem and mount point with the row for
/. - If the filesystem differs, investigate the capacity of the filesystem reported for
/homerather than assuming it shares root capacity.
df shows unfamiliar entries
If you used df -a and see entries under /proc, /sys, or /dev, remember that these are often pseudo-filesystems. Focus routine disk-space investigations on relevant persistent mount points.
Quick Reference
df # Default mounted-filesystem report
df -h # Human-readable capacity
df -t ext4 # Only ext4 filesystems
df -i # Inode usage
df -a # Include normally omitted entries
df /home # Filesystem containing /home
df -h / /home /var # Several paths in readable unitsRelated Linux Storage Commands
- Linux command-line topics
- Show the full path of shell commands
- Use
duto inspect directory and file usage afterdfidentifies a full filesystem. - Use
lsblkto view disks, partitions, and block devices. - Use
mountorfindmntto inspect mounted filesystems.