“How do you check disk space in Linux?” is a commonly asked question in Linux job interviews — and it hides a subtlety that trips up a lot of candidates.
Disk space usage and disk utilization are not the same thing:
- Disk space usage — how much of the disk’s capacity is filled with data (a percentage of total bytes).
- Disk utilization — how busy the disk is servicing I/O requests, regardless of how full it is.
A disk can be 90% full and nearly idle, or 10% full and completely saturated with I/O. This guide covers both, with the commands used to check each.
Table of Contents
Check disk space with the df command
df (disk free) reports the total and available space for every mounted filesystem. It’s the standard tool for monitoring disk capacity and growth over time.
Running df lists every mounted drive, its mount point, total size, and available space — which helps administrators spot a partition that’s filling up before it becomes a problem.
Understanding the df output columns
| Column | Meaning |
|---|---|
| Filesystem | The name of the disk partition or logical volume |
| Size | The total size of the filesystem |
| Used | The total space currently allocated to files |
| Avail | The total space still available |
| Use% | The percentage of space already used |
| Mounted on | The directory where the filesystem is mounted |
Common df options
| Option | Description |
|---|---|
-h | Human-readable sizes (e.g., 1K, 234M, 2G) |
-a | Include pseudo and zero-block filesystems normally hidden from the default listing |
-T | Show the filesystem type alongside usage (e.g., xfs, ext4, btrfs) |
-i | Show inode usage instead of block usage |
-t TYPE / --type=TYPE | Limit the listing to filesystems of a given type |
Example
df -h
Output:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/wbx_vg-root 20G 1.8G 18G 9% /
/dev/mapper/wbx_vg-opt 9.8G 217M 9.6G 3% /opt
/dev/mapper/wbx_vg-tmp 4.9G 45M 4.9G 1% /tmp
/dev/mapper/wbx_vg-u00 43G 20G 24G 46% /u00
/dev/mapper/wbx_vg-var 9.8G 757M 9.1G 8% /var
/dev/mapper/wbx_vg-var_crash 33G 39M 33G 1% /var/crash
/dev/sdo1 509M 159M 350M 32% /boot
At a glance, /u00 is the fullest partition here at 46%, while everything else has comfortable headroom.
Check disk space for a file or directory with du
du (disk usage) estimates the space used by files and directories, rather than an entire filesystem. It’s the tool you reach for once df tells you a partition is filling up and you need to find out why.
Use du to see which directories are taking up the most space, so you know what to clean up or archive. It’s also the right tool for checking the size of an individual file.
du -h /home/howtouselinux/test
Output:
See also: Mastering the Linux Command Line — Your Complete Free Training Guide
44K /home/howtouselinux/test/data
2.0M /home/howtouselinux/test/system_design
24K /home/howtouselinux/test/table/sample_table/tree
df vs du: what’s the difference?
df | du | |
|---|---|---|
| Scope | Entire filesystem/partition | A specific file or directory tree |
| Answers | “How much space is free on this disk?” | “What’s using the space in this folder?” |
| Typical use | Spot a filesystem approaching capacity | Find the files/directories responsible |
In short: df tells you there’s a problem, du tells you where it is.
How to fix a disk space issue in Linux
A practical workflow for a full disk:
- Identify the full partition with
df -hand look at theUse%column. Anything consistently above 80% deserves attention. - Find what’s consuming the space with
du, focusing on the largest files and directories under that mount point. - Reclaim the space by removing files you no longer need, or by moving large files to a partition with more room.
See also: Understanding Linux disk partitions and “No space left on device” even though there’s free space for a trickier variant of this problem.
FAQ: Disk commands in Linux
How do I check disk performance with iostat?
Disk performance tuning starts with visibility into current I/O activity. iostat reports read/write throughput, request counts, and average response time per device:
iostat -xk /dev/sda
This prints a snapshot of read/write operations and latency for the device, which is the starting point for diagnosing a slow disk.
How do I check which process is using the most disk I/O?
iotop shows I/O activity broken down per process, so you can identify exactly what’s hammering the disk:
sudo iotop -aoP
This reports accumulated I/O per process (-a), limited to processes actually doing I/O (-o), with process IDs shown (-P) — letting you pinpoint the culprit quickly.
How do I test raw disk read/write speed with dd?
dd can be used as a rough benchmark of sequential write and read throughput.
Test write speed:
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
Test read speed:
dd if=test of=/dev/null bs=64k count=16k
conv=fdatasync ensures the write is flushed to disk before dd reports its timing, so the result reflects real disk speed rather than just the page cache. Delete the test file afterward — this is a benchmarking tool, not something to leave lying around.
How do I check disk utilization on Linux?
This is the other half of the “disk space vs. disk utilization” distinction from the intro. iostat reports utilization in the %util column — the percentage of time the device was busy servicing I/O requests. If it’s consistently above 80%, investigate the workload’s IOPS, I/O size, or storage latency.
iostat -kx 3 /dev/sdo
Output:
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sdo 0.06 0.78 1.62 13.27 98.69 177.04 37.04 0.50 33.48 72.83 28.68 4.21 6.27
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sdo 0.00 0.00 0.00 12.00 0.00 82.50 13.75 0.18 15.22 0.00 15.22 4.56 5.47
Here %util is low (around 5–6%), meaning the disk is mostly idle even though it’s actively serving some reads and writes — a good illustration of why disk space usage and disk utilization need separate tools to measure.
Summary
| Question | Command |
|---|---|
| How much space is free on this filesystem? | df -h |
| What’s using space in this directory? | du -h /path |
| Is the disk running out of space? | df -h, check Use% |
| What’s consuming the space? | du -h, sorted by size |
| Is the disk I/O-bound (busy)? | iostat -xk /dev/sdX, check %util |
| Which process is causing disk I/O? | iotop -aoP |
| What’s the raw read/write speed? | dd with conv=fdatasync |
df and du answer “how much space,” while iostat and iotop answer “how busy.” Knowing which question you’re actually asking is the key to diagnosing disk issues quickly — and to answering this one correctly in an interview.



