Using Additional Options with df
The df
command offers several other useful options that can provide additional information or change how the output is displayed. In this step, you will explore some of these options to enhance your disk space monitoring capabilities.
Display File System Type
The -T
option adds a column showing the filesystem type. This can be valuable when you need to know what type of filesystem you are working with, as different filesystem types have different features and limitations.
Run the following command:
df -hT
This combines the human-readable format (-h
) with the filesystem type display (-T
). You should see output similar to:
Filesystem Type Size Used Avail Use% Mounted on
overlay overlay 20G 3.1G 16G 17% /
tmpfs tmpfs 386M 0 386M 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
shm tmpfs 64M 0 64M 0% /dev/shm
/dev/sda1 ext4 20G 3.1G 16G 17% /etc/hosts
tmpfs tmpfs 1.9G 0 1.9G 0% /proc/acpi
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/firmware
Notice the new "Type" column, which shows filesystem types like "overlay", "tmpfs", and "ext4".
Filesystems have a limited number of inodes, which are data structures that store information about files. Even if you have plenty of disk space, you can run out of inodes if you have too many small files.
Check inode usage with the -i
option:
df -i
You will see output showing inode utilization:
Filesystem Inodes IUsed IFree IUse% Mounted on
overlay 1310720 106794 1203926 9% /
tmpfs 98811 1 98810 1% /dev
tmpfs 98811 16 98795 1% /sys/fs/cgroup
shm 98811 1 98810 1% /dev/shm
/dev/sda1 1310720 106794 1203926 9% /etc/hosts
tmpfs 98811 1 98810 1% /proc/acpi
tmpfs 98811 1 98810 1% /sys/firmware
The output shows:
Inodes
: Total number of inodes
IUsed
: Number of inodes that are used
IFree
: Number of free inodes
IUse%
: Percentage of inodes that are used
This information is particularly useful when troubleshooting situations where you have disk space available but cannot create new files because you have run out of inodes.
Combining Options
You can combine these options to get a comprehensive view. For example, to see human-readable disk space and inode usage together:
df -hi
This provides a more complete picture of your filesystem usage:
Filesystem Inodes IUsed IFree IUse% Mounted on
overlay 1.3M 107K 1.2M 9% /
tmpfs 97K 1 97K 1% /dev
tmpfs 97K 16 97K 1% /sys/fs/cgroup
shm 97K 1 97K 1% /dev/shm
/dev/sda1 1.3M 107K 1.2M 9% /etc/hosts
tmpfs 97K 1 97K 1% /proc/acpi
tmpfs 97K 1 97K 1% /sys/firmware