File system and storageIntermediate25 min read

What Does df Mean?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security

This page mentions older exam versions. See the Current Exam Context and Legacy Exam Context sections below for the updated mapping.

On This Page

Quick Definition

The df command shows how much space is used and free on your computer's hard drives and storage devices. It stands for 'disk free' and is a standard tool in Linux, Unix, and macOS. You run it in a terminal to quickly check your storage usage.

Common Commands & Configuration

df -h

List all mounted file systems with sizes in human-readable format (K, M, G). This is the most common usage for everyday checks.

df -i

Display inode usage instead of block usage. Crucial for diagnosing 'No space left on device' errors when df -h shows free space.

df -hT

Add a column showing the file system type (ext4, nfs4, tmpfs, etc.), useful for distinguishing local disks from network mounts.

df -h /var/log

Show the file system usage for the partition that contains the /var/log directory. Focused view for targeted troubleshooting.

df --sync -h

Synchronize the file system before reading statistics to get the most current cached data written to disk. Useful for accurate snapshots.

Must Know for Exams

The df command is a staple of the Linux+ (XK0-005), Red Hat Certified System Administrator (RHCSA), LPIC-1 (101 and 102), and CompTIA A+ certifications. In the Linux+ exam, objectives related to file system management, disk monitoring, and command-line skills explicitly require familiarity with df and its common options. You will be tested on its syntax, basic output interpretation, and how it differs from du. For example, the objective 'Given a scenario, perform basic file management operations' highlights the need to assess disk space usage.

In the RHCSA exam, df is pivotal in tasks like 'Manage storage devices, file systems, and logical volumes'. You might be asked to check the available space on a specific partition before extending a logical volume, or to verify that a new mount point is correctly represented in df output. The exam also tests the use of df -h for human-readable output and df -i for inode usage. Questions may involve interpreting df output to determine which file system is nearly full and then using other commands like du or lvextend to resolve the issue.

The LPIC-1 exam covers df under Topic 104: Devices, Linux File Systems, Filesystem Hierarchy Standard. Candidates must understand how to use df to display file system disk space usage, including options like -T to show file system type and -a to include dummy file systems with zero blocks. Performance-based questions (PBQs) may ask you to examine a provided df output and identify the device that is running low on space, or to use df in a script to generate a report.

Even in the CompTIA Network+ exam, which focuses on networking, you may encounter df in the context of troubleshooting network-attached storage (NAS) or monitoring storage on remote servers. The exam objectives for cloud-related certifications like AWS SysOps Administrator also assume you understand df when managing EC2 instance storage volumes. In all cases, the exam questions rarely ask 'What does df stand for?' Instead, they present a scenario: a database is writing slowly, or a scheduled job is failing, and you must analyze a command output snippet (often of df -h) to isolate the root cause. Mastery of df means knowing not just the command, but which option to use (-h, -i, -T) in a given troubleshooting scenario, and how to combine it with other commands for a complete diagnostic workflow.

Simple Meaning

Imagine you have several storage bins in your house for different things: one for books, one for holiday decorations, and one for spare tools. Each bin has a limited capacity. To know how full each bin is, you need a way to measure them all at once. In the world of computers, especially servers and personal computers running Linux, the 'df' command is exactly that measuring tape.

When you type 'df' in a terminal, the computer looks at all the partitions (like the different bins) and reports how much total space they have, how much is currently used by files, and how much remains free. It also shows the mount point, which is the location in the file system where you can access that storage. For example, your main hard drive might be mounted at the root (/), while a USB drive might be mounted at /mnt/usb.

Just as you wouldn’t want your decoration bin to overflow and be unable to store new items for next year, a system administrator doesn’t want a critical file system to fill up. If a file system runs out of space, programs can crash, databases can stop working, and users may not be able to save their work. The df command provides a simple, quick way to monitor this vital health metric of any computing system.

The output of df uses units like kilobytes (KB), megabytes (MB), or gigabytes (GB). By default, it shows sizes in 1K blocks, but you can use options like -h (human-readable) to see sizes in a format you might see on your phone's storage settings, like 50G for 50 gigabytes. This makes it easy for anyone, even beginners, to get a clear picture of disk usage at a glance.

Full Technical Definition

The df command, short for 'disk free', is a standard Unix utility that reports the amount of available disk space on file systems. Its origins date back to early Unix systems and it is now a core component of POSIX, making it available on all Linux distributions, macOS, and other Unix-like operating systems. The command reads information from the file system-specific superblocks and inodes. For each mounted file system, df queries the kernel’s virtual file system (VFS) layer, which abstracts the details of the underlying hardware and file system type (such as ext4, XFS, Btrfs, or NTFS). The kernel maintains per-file-system statistics that include total block count, used block count, available block count, and inode usage. Available space typically reflects the amount of space accessible to unprivileged users, which may be less than the total free space because a reserve of blocks (usually 5%) is set aside for the root user to ensure system processes can still write critical logs even when a disk is nearly full.

The standard df output presents several columns: Filesystem (the device or remote share), 1K-blocks (total capacity in 1-kilobyte units), Used (space occupied), Available (space left for regular users), Use% (percentage used), and Mounted on (the directory path where the file system is accessible). The -h flag reformats these values into human-readable units like 'G' (gigabytes) or 'M' (megabytes), which is the most common way administrators use the command day-to-day. Another critical variant is df -i, which displays inode usage rather than block usage. Inodes are data structures that store metadata about files (permissions, timestamps, pointers to data blocks). If you run out of inodes, you cannot create new files even if there is free space, because the file system has run out of slots to store file metadata.

Under the hood, df works by calling the statfs() or statvfs() system call. The kernel retrieves the statistics from the file system driver and populates a structure with the requested data. This makes df a very lightweight operation because it does not need to traverse directory trees or open files; it simply reads pre-cached metadata from memory. This design means df is safe to run frequently and on large file systems without a significant performance penalty. In network file systems like NFS, the command may involve a lightweight remote procedure call (RPC) to the server, but the overhead is still minimal. The utility supports many other options: -T to show the file system type, --exclude-type to ignore certain file systems (like tmpfs or loopback devices), and --sync to force a sync of cached writes before reading disk usage data (useful for obtaining a more accurate real-time snapshot).

For IT professionals, understanding df is not just about running a command but interpreting its output correctly in different contexts. For example, a file system may show 0% available yet still have free space if it is a read-only file system, or it may show a very high Used percentage on a dynamically growing storage like ZFS or Btrfs that uses copy-on-write. On cloud instances, virtual disks might be thin-provisioned, meaning the total reported space does not reflect the actual physical allocation. Docker container environments often use overlay2 file systems that report the capacity of the underlying host filesystem. Knowing these nuances is critical for accurate capacity planning and avoiding false alarms.

Real-world implementations often involve scripting df into monitoring tools like Nagios, Zabbix, or Prometheus. A typical alert threshold triggers when Use% exceeds 80% or 90%. Administrators also use df in combination with other commands like du (disk usage) to identify which directories are consuming space, or with find and sort to locate unusually large files. In exam contexts, you may be asked to construct commands such as `df -h /var/log` to check a specific partition, or `df -i` to troubleshoot a 'No space left on device' error even though df -h reports free space. Mastery of df and its options is a foundational skill for Linux system administration, cloud engineering, and DevOps roles.

Real-Life Example

Think of your closet at home. You have shelves, drawers, and a hanging rod. Each section has a limit: the shelf can hold twenty folded t-shirts, the drawer ten pairs of socks, and the rod fifteen hangers. To know if you can fit a new jacket, you need to quickly check each area. You open the closet, glance at the shelf, see it has room for three more shirts, look at the drawer, see it is empty, and check the rod, which is full. In this analogy, df is you quickly scanning the closet sections.

Your eyes are the df command. Each section of the closet represents a mounted file system. The capacity of each section is the total blocks of a partition. The free space on the shelf is the available space. The used space is the clothes already there. The mount point is like the label you’ve put on each section: 'Shelf for shirts', 'Drawer for socks'. When you run df, you get a report of all these sections at once. In the computer world, these sections might be your main hard drive (/, or the root partition), your /home partition (where user files live), and a removable USB drive (mounted under /media/usb).

Now imagine you are getting ready for a trip and want to pack a heavy winter coat. You need to know the rod has space. If you see the rod is full, you will remove some items to make room. Similarly, if a system administrator sees that the /var/log partition is 95% full, they know the logs are about to overflow, which could crash the system. They might delete old logs or add more storage. This everyday closet check mirrors the critical function of df in keeping a computer system healthy. Without it, you would be guessing, and guessing could lead to a full disk and a system outage.

Why This Term Matters

In any IT environment, storage is a finite and critical resource. Running out of disk space can cause system crashes, failed backups, stalled databases, and frustrated users. The df command gives a real-time, immediate snapshot of how fast this critical resource is being consumed. For system administrators, operations teams, and DevOps engineers, df is often the first command typed when something goes wrong with writes or performance.

Imagine a production web server where the application logs have been writing silently for days. Without checking df, you would not know that the root file system is at 99% capacity. That tiny remaining space could be reserved for the root user, meaning regular services (like your web server) cannot write new log entries or even update temporary files. The result is an application crash that could take down a customer-facing website. By running df regularly, you can set up proactive alerts (monitoring scripts) that email the team when usage crosses a threshold, allowing you to clean up logs or expand storage before any service interruption occurs.

Beyond immediate crisis management, df supports capacity planning. By tracking historical df output, organizations can model disk usage growth rates and decide when to purchase additional storage or implement cleanup policies. In cloud environments, where storage costs money per GB, running df helps ensure you are not wasting budget on over-provisioned volumes. In Docker container environments, the overlay2 file system can easily fill the host's /var/lib/docker mount point with images and layers; regular df checks can prevent a container from failing to start. Df is a small tool that provides enormous value for maintaining system stability, planning capacity, and troubleshooting disk-related failures. It is a non-negotiable part of every IT professional’s toolkit, from helpdesk support to senior infrastructure architects.

How It Appears in Exam Questions

Exam questions typically present a scenario followed by a snippet of df output or ask you to select the correct command to solve a disk-related problem. A common pattern is: 'A systems administrator receives an alert that the /var partition is 95% full. Which command would the administrator use to verify this information?' The correct answer is df -h /var, but distractors might include du -sh /var (which shows the size of the directory contents, not the free space of the partition) or fdisk -l (which lists partition tables, not usage).

Another frequent question type: 'A user reports a 'No space left on device' error when trying to create a file, but df -h shows 10GB free. What is the most likely cause?' This tricky question tests knowledge of inodes. The correct answer is that the file system has run out of inodes, which can be confirmed with df -i. Learners who only know df -h will be misled by the free space. The exam wants you to diagnose the real issue.

Performance-based questions (PBQs) in Linux+ and RHCSA can be more complex. You might log into a virtual terminal and run df to check space on a mounted NFS share, then use another command like mount or lsblk to verify the share is still mounted. Or you might receive a df output with multiple lines and be asked to identify which file system corresponds to the root partition, which one is a tempfs, and which is a remote NFS mount. This tests your ability to parse the 'Filesystem' column and understand device names (/dev/sda1), tmpfs, and host:path formats.

Questions also combine df with planning. For example: 'A new log rotation policy needs to retain logs for 30 days on the /var/log partition. Current usage is 80% of a 100GB partition. Assuming 1GB of log growth per day, will the partition have enough space for the new policy?' This involves interpreting df output and doing simple arithmetic. In all cases, the exam expects you to not only know the command but to use it analytically in real-world scenarios. The most common trick is overlooking the -h flag: the default output uses 1K blocks, which can make a 50GB partition look like 50 million blocks, confusing an unprepared candidate. Always use -h in multiple-choice answers when the output is shown in human-readable form.

Practise df Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

Alex is a junior system administrator at a small web hosting company. A customer calls in saying that their website is not loading, and they get a '500 Internal Server Error'. Alex first pings the server to confirm it is up, then SSHes into the machine. He suspects the issue might be due to a full disk, because log files for the web server can grow quickly. He runs the command 'df -h' and sees the following output:

Filesystem Size Used Avail Use% Mounted on /dev/sda1 98G 92G 5.2G 95% / tmpfs 7.8G 120M 7.7G 2% /dev/shm /dev/sdb1 500G 300G 200G 60% /backup

The root file system (/) is at 95% usage and only 5.2GB are free. Since the web server's application files, logs, and temporary directories all live under /, this high usage could certainly cause the website to crash. Alex then runs 'df -i /' to check inodes, just in case, and sees only 10% of inodes are used, ruling out that cause. He navigates to /var/log/httpd and finds the access_log is over 30GB. He safely rotates and compresses the old log files, regaining 25GB of space. Afterward, he runs 'df -h' again and sees that the root partition is now at 65% usage. He asks the customer to reload the website, and it works perfectly.

This scenario illustrates the typical workflow: identify the symptom (site down), use df -h to check disk usage, identify the offending partition, use df -i to check inodes if needed, investigate the directory (using du), free space by removing or compressing files, and verify the fix with df -h again. Alex also adds a monthly cron job to automatically rotate the web server logs so the problem does not recur. The keys are using the correct command (df), selecting the right options (-h, -i), and interpreting the output to make a practical decision. Without df, Alex would have wasted time looking at memory, CPU, or network issues, while the real problem was simply a full disk.

Common Mistakes

Using df -h to check the size of a specific directory or file.

df reports free space on an entire file system (partition), not the size of a single directory. The size of a directory is found by du (disk usage).

Use du -sh directory_name to see the size of a directory. Use df -h to see the overall free space on the partition that contains that directory.

Assuming df -h shows all available space as usable by regular users.

By default, Linux reserves 5% of blocks for the root user (to maintain system stability). The 'Avail' column in df output reflects space available to regular users, which is less than the total free space.

Understand the difference between 'Used' and 'Avail'. If a partition is nearly full, root can still write, but regular processes may get a 'disk full' error. Use 'tune2fs -m' to adjust the reserved percentage if appropriate.

Running df without the -h flag and misinterpreting the numbers in 1K blocks.

The default output is in 1K blocks, which can be thousands or millions of blocks. It is easy to misread a value like '50,000,000' as 50MB instead of ~50GB.

Always use the -h (human-readable) option unless you specifically need block counts. This will show sizes in K, M, G for easy understanding.

Thinking df -i shows free space instead of inode usage.

df -i changes the output to show inode information (total inodes, used, free, and %use). Inodes are file metadata slots, not data blocks. A file system can have many free blocks but zero free inodes, preventing new file creation.

Use df -h to check block space and df -i to check inode space. If you get a 'No space left on device' error but df -h shows free space, immediately run df -i to check inode exhaustion.

Forgetting that df on an NFS mount might be slow or show stale data.

For network file systems, df queries the NFS server, which may introduce latency. If the server is unreachable, df may hang or return outdated cached data depending on mount options.

Use df with the --direct option (if supported) or 'stat -f /mountpoint' for a more reliable check. Also consider using the 'nfsstat' command for detailed NFS statistics.

Confusing df output columns, especially the 'Use%' for tmpfs.

tmpfs mounts (like /dev/shm) are in-memory file systems. Their 'Use%' can be high even when the system is not under memory pressure, but this does not indicate a full disk. Some beginners panic when they see 100% on tmpfs.

Recognize tmpfs, devtmpfs, and cgroup file systems as special types. They do not represent physical disk usage. Use the -T option to display file system type and filter them out if they cause confusion.

Exam Trap — Don't Get Fooled

{"trap":"The exam shows df -h output with a file system showing 90% used, but the question asks why an application cannot write a small log file, and the answer choices include 'disk is full' and 'inode exhaustion'. The learner picks 'disk is full'.","why_learners_choose_it":"They see the high percentage in df -h and assume that is the only problem.

They forget that df -i checks a separate resource (inodes). The scenario cleverly hides that the file system has 1TB total but 90% is used by a single huge file, yet there are millions of small files consuming all inodes.","how_to_avoid_it":"When you see a 'No space left on device' error, always run two commands: df -h (check block space) and df -i (check inode space).

If df -h shows free space, the issue is almost certainly inode exhaustion. In an exam question, if df -h shows some used, but not 100%, look for an answer mentioning inodes or file count. The best way to avoid the trap is to systematically check both metrics before concluding the cause."

Commonly Confused With

dfvsdu

du (disk usage) estimates the size of a specific file or directory by traversing its entries. df reports the total usage for an entire mounted file system. Use du to find what is taking up space within a partition; use df to see the big picture of partition usage.

df -h /home shows the free space on the /home partition. du -sh /home/user shows the size of only that user's directory.

dfvsfdisk

fdisk is a disk partitioning tool used to create, delete, and resize partitions on a hard disk. df does not modify partitions; it only reads and reports usage statistics of already mounted file systems.

Use fdisk -l to list all partitions on a disk (e.g., /dev/sda1, /dev/sda2). Use df -h to see how full /dev/sda1 is.

dfvslsblk

lsblk (list block devices) shows information about all available block devices and their partitions, including size, type, and mount point. It does not show used vs. free space. In contrast, df provides that usage detail.

lsblk shows that /dev/sda1 is a 100GB partition mounted at /. df -h / will tell you that 90GB of that 100GB is used.

Step-by-Step Breakdown

1

Open the terminal

On Linux, macOS, or other Unix-like systems, open a terminal emulator application. This gives you the command-line interface where you type the df command.

2

Run the basic df command

Type 'df' and press Enter. The system reads the kernel's file system statistics for all currently mounted file systems, then prints a table to the screen. The columns represent Filesystem, total 1K-blocks, Used, Available, Use%, and Mounted on.

3

Use the -h option for human-readable sizes

Type 'df -h'. The -h flag converts the block counts into a more intuitive format (e.g., 50G instead of 50000000). This is the most common mode used by administrators for quick interpretation.

4

Check a specific mount point or file system

You can limit output to one file system by providing its device path or mount point. For example, 'df -h /var/log' shows only the partition on which /var/log resides. This helps focus on a single resource.

5

Examine inode usage with df -i

If you suspect file system metadata exhaustion, type 'df -i'. This changes the output to show total, used, and free inodes for each file system. If the Use% column here is near 100%, you have an inode problem, not a space problem.

6

Include file system type with df -T

Run 'df -hT' to add a 'Type' column showing the file system type (ext4, xfs, nfs4, tmpfs, etc.). This is useful when you need to differentiate between local disks, network mounts, and virtual memory file systems.

7

Interpret the output and take action

Based on the results, decide on next steps. If a partition is more than 80% full, plan cleanup or expansion. If inodes are exhausted, delete unnecessary small files or archives. Use other commands like du, ls, and rm to manage the files.

Practical Mini-Lesson

The df command is a fundamental tool for any systems administrator, DevOps engineer, or IT support professional. In practice, you rarely run df in isolation; it is part of a diagnostic workflow. Suppose a monitoring system alerts you that a production database server's /var/lib/mysql partition is at 85% capacity. Your first action is to SSH into the server and run df -h to confirm the alert. You see that the partition is indeed 85% used. Now you need to determine the growth rate. You run df -h again after 5 minutes, and the percentage has not changed, but you know that logs are being written. You then run df -i to check inodes, because a table corruption could have created millions of small temporary files. The inode usage is at 2%, so that is not the issue.

Next, you identify the largest contributors to disk usage within that partition. You use the du command: du -sh /var/lib/mysql/* | sort -rh | head -10. This shows the ten largest databases or files. You find a database that is 200GB but has not been accessed in six months. After confirming with the application team, you archive and remove it, recovering space. You run df -h again and see usage has dropped to 60%. To prevent future issues, you set up a cron job that runs df -h nightly and emails the results to you, and you also add disk usage thresholds to your monitoring platform.

Another real-world nuance: you may need to run df on a server that uses logical volume management (LVM). In such cases, df shows the logical volume device (like /dev/mapper/vg_root-lv_root). Before you can extend that volume, you need to check the underlying volume group and physical volumes using commands like vgdisplay and pvdisplay. Running df first gives you the current usage, which tells you the minimum size the volume needs to be extended. If you extend a logical volume without understanding the df usage, you might allocate too much or too little space. This interdependence between df and LVM tools is a hallmark of professional system administration.

What can go wrong? If you run df while a file system is under heavy write load, the numbers may be slightly stale because the kernel caches metadata. This is usually fine for capacity monitoring, but for precision, you can use the --sync option to force a file system sync before reading. Another common issue is df hanging on an NFS mount that has lost connectivity. In such cases, you can use the --timeout option or run df with the -l flag to list only local file systems. For scripting, always use df -hP (the -P flag enables POSIX output format) to avoid line-wrapping on long device names, which can break scripts that parse the output. Mastering df means knowing not just the command and options, but also the context of the surrounding tools (du, LVM, mount, lsblk) and the operational pitfalls to avoid.

Troubleshooting Clues

Symptom: Website returns 500 error, SSH works, but df -h shows root partition at 99%

Symptom: Touch test file fails with 'No space left on device', but df -h shows 10GB free

Symptom: df hangs or takes very long to respond

Symptom: df reports a tmpfs with 100% used and 0 available

Memory Tip

‘df’ = ‘Disk Free’, think of it as checking how much room you have left on your disk, like the fuel gauge in your car.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Legacy Exam Context

Older materials may mention these exam versions, but learners should use the current objectives for their target exam.

XK0-005XK0-006(current version)

Related Glossary Terms

Quick Knowledge Check

1.Which command shows disk space usage in a human-readable format on all mounted file systems?

2.A user gets 'No space left on device' but df -h reports 50% free space. What should you check next?

3.Which of the following commands shows only the file system type and usage for the partition mounted at /home?

4.What does the 'Avail' column in df -h output represent?

5.Which option of df forces a file system sync before reporting usage?

Frequently Asked Questions

What does 'df' stand for?

df stands for 'disk free'. It displays the amount of available and used disk space on file systems.

How is df different from du?

df shows free space on an entire file system (partition), while du shows the size of individual directories or files. Use df for capacity planning and du for finding large directories.

Why does df show less available space than the total free space?

Linux reserves a percentage of blocks (usually 5%) for the root user. This reserved space prevents critical system processes from failing when users fill the disk. The 'Avail' column is after this reservation.

What should I do if df -h shows space but I still cannot create files?

Run df -i to check inode usage. If inodes are exhausted, you have too many small files, and you need to delete some or recreate the file system with more inodes.

Is df available on Windows?

No, df is a Unix command. On Windows, the equivalent is the general command, or you can use 'wmic logicaldisk get size,freespace,caption' from the command prompt.

Can df show remote file systems like NFS?

Yes, df includes all mounted file systems, including network file systems like NFS or CIFS. The output will show the remote path in the 'Filesystem' column.

What does the 'Use%' column mean if it's over 100%?

It shouldn't normally exceed 100%. If it does, it indicates a corrupted file system or unaccounted overhead. You may need to run a file system check (fsck).