Monitoring disk space on a Linux system prevents services from failing when partitions run out of free space and log or data writes start to error. Regular checks keep enough headroom for updates, backups, and application data growth across all mounted filesystems.
The df utility queries kernel filesystem statistics to display each mount point’s total size, used space, available space, and usage percentage. Output combines information for physical disks, partitions, and virtual filesystems, making it suitable for a quick overview of how storage is allocated and consumed.
Separating directories such as /var and /home into dedicated partitions improves isolation but also increases the chance that a single partition fills up while others still have free space. df focuses on filesystem-level usage rather than individual files or folders, so it pairs with tools like du in other workflows for locating large directories.
Steps to monitor disk space and free space in Linux:
- Open a terminal on the Linux system.
- Display disk and partition size, usage, and available space for all mounted filesystems using df.
$ df Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 399520 1340 398180 1% /run efivarfs 104 5 100 5% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 31270768 5872264 23784476 20% / tmpfs 1997588 0 1997588 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock /dev/sda2 1992552 199468 1671844 11% /boot /dev/sda1 1098628 6516 1092112 1% /boot/efi ##### snipped ##### tmpfs 399516 20 399496 1% /run/user/1000
- Present usage and available space in a human-readable format using df -h.
$ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 391M 1.4M 389M 1% /run efivarfs 104K 4.9K 100K 5% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 30G 5.7G 23G 20% / tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sda2 2.0G 195M 1.6G 11% /boot /dev/sda1 1.1G 6.4M 1.1G 1% /boot/efi ##### snipped ##### tmpfs 391M 20K 391M 1% /run/user/1000
Unit changed to M (Megabyte), G (Gigabyte), T (Terabyte) etc instead of in blocks.
- Hide temporary and virtual filesystems to focus on real disks by excluding tmpfs and devtmpfs.
$ df -h -x tmpfs -x devtmpfs Filesystem Size Used Avail Use% Mounted on efivarfs 104K 4.9K 100K 5% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 30G 5.7G 23G 20% / /dev/sda2 2.0G 195M 1.6G 11% /boot /dev/sda1 1.1G 6.4M 1.1G 1% /boot/efi ##### snipped #####
Excluding pseudo-filesystems makes it easier to spot partitions that are actually at risk of filling up.
- Display disk usage information for a specific partition by device name.
$ df -h /dev/sda1 Filesystem Size Used Avail Use% Mounted on /dev/sda1 1.1G 6.4M 1.1G 1% /boot/efi
- Display disk usage information for a specific mount point.
$ df -h /boot Filesystem Size Used Avail Use% Mounted on /dev/sda2 2.0G 195M 1.6G 11% /boot
- Show disk usage in a variety of formats and with filesystem type details using different df options.
$ df -hT Filesystem Type Size Used Avail Use% Mounted on tmpfs tmpfs 391M 1.4M 389M 1% /run efivarfs efivarfs 104K 4.9K 100K 5% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv ext4 30G 5.7G 23G 20% / tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sda2 ext4 2.0G 195M 1.6G 11% /boot /dev/sda1 vfat 1.1G 6.4M 1.1G 1% /boot/efi ##### snipped ##### tmpfs tmpfs 391M 20K 391M 1% /run/user/1000
- Check inode usage to detect situations where a filesystem has free space but no free inodes.
$ df -i Filesystem Inodes IUsed IFree IUse% Mounted on tmpfs 499397 953 498444 1% /run efivarfs 0 0 0 - /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 1998848 147719 1851129 8% / tmpfs 499397 1 499396 1% /dev/shm tmpfs 499397 4 499393 1% /run/lock /dev/sda2 131072 264 130808 1% /boot /dev/sda1 0 0 0 - /boot/efi ##### snipped ##### tmpfs 99879 36 99843 1% /run/user/1000
High inode usage can block new file creation even when size-based usage appears low.
- Limit output to key columns such as source, size, usage, and mount point using df –output.
$ df -h --output=source,size,used,avail,pcent,target -x tmpfs -x devtmpfs Filesystem Size Used Avail Use% Mounted on efivarfs 104K 4.9K 100K 5% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 30G 5.7G 23G 20% / /dev/sda2 2.0G 195M 1.6G 11% /boot /dev/sda1 1.1G 6.4M 1.1G 1% /boot/efi ##### snipped #####
- Explore additional df command options to better monitor disk size and usage in Linux.
$ df --help Usage: df [OPTION]... [FILE]... Show information about the file system on which each FILE resides, or all file systems by default. Mandatory arguments to long options are mandatory for short options too. -a, --all include pseudo, duplicate, inaccessible file systems -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes; see SIZE format below -h, --human-readable print sizes in powers of 1024 (e.g., 1023M) -H, --si print sizes in powers of 1000 (e.g., 1.1G) -i, --inodes list inode information instead of block usage -k like --block-size=1K -l, --local limit listing to local file systems --no-sync do not invoke sync before getting usage info (default) --output[=FIELD_LIST] use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted. -P, --portability use the POSIX output format --sync invoke sync before getting usage info --total elide all entries insignificant to available space, and produce a grand total -t, --type=TYPE limit listing to file systems of type TYPE -T, --print-type print file system type -x, --exclude-type=TYPE limit listing to file systems not of type TYPE -v (ignored) --help display this help and exit --version output version information and exit Display values are in units of the first available SIZE from --block-size, and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set). The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on. FIELD_LIST is a comma-separated list of columns to be included. Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page). GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Full documentation <https://www.gnu.org/software/coreutils/df> or available locally via: info '(coreutils) df invocation'Related: df man page
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
