6 df Command Examples To Check Mounted Filesystem On Linux

In this tutorial we will learn about, how to use df command to check the mounted filesystem on linux. As a Linux System administrator, this command is basic and very important.
The df command shows the usage of mounted filesystem.It is notable that the filesystems which are not mounted on system,we can not get its information by using df command.

We are writing some examples of df command which will help you in system administration.

Example 1: df command

Without using any other option with df command,it shows disk space in 1K blocks by default.
See the reference as given below :

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda5       28835836 25781720   1589336  95% /
udev             2025248        4   2025244   1% /dev
tmpfs             814768     1052    813716   1% /run
none                5120        4      5116   1% /run/lock
none             2036912     3996   2032916   1% /run/shm
none              102400       68    102332   1% /run/user
cgroup           2036912        0   2036912   0% /sys/fs/cgroup
/dev/sda7        9614116  3439440   5686304  38% /partition7
/dev/sda8       48062440 44482732   1138232  98% /partition8
/dev/sda9       76896316 53361192  19628924  74% /partition9
/dev/sda21      14418416  8003400   5682600  59% /partition10
root@tuxworld:~# 

Example 2: Using -h option with df command

By using -h option with df command , print sizes in human readable format. Means it prints size in GB,MB etc.

Note: In first example,we have seen the sizes are in Kilobytes size.(By default)

See below given reference: In column Size,Used and Avail, you can see the sizes are in human readable format.

root@tuxworld:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5        28G   25G  1.6G  95% /
udev            2.0G  4.0K  2.0G   1% /dev
tmpfs           796M  1.1M  795M   1% /run
none            5.0M  4.0K  5.0M   1% /run/lock
none            2.0G  4.0M  2.0G   1% /run/shm
none            100M   68K  100M   1% /run/user
cgroup          2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda7       9.2G  3.3G  5.5G  38% /partition7
/dev/sda8        46G   43G  1.1G  98% /partition8
/dev/sda9        74G   51G   19G  74% /partition9
/dev/sda21       14G  7.7G  5.5G  59% /partition10
root@tuxworld:~#

Example 3: Using -T option with df command

In this example we will use -T option with df command. Using -T options print the type of filesystem. For example, the filesystem type can be ext2,ext3,ext4,tmpfs etc. This information sometimes very helpful for Linux System Administrator,in terms of troubleshooting and auditing.

See below given reference:
Here we will use -T option with df command. To make the output more user friendly we will also use -h option.

In below given output, you can see Type column which is shown after using -T option.

root@tuxworld:~# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda5      ext4       28G   25G  1.6G  95% /
udev           devtmpfs  2.0G  4.0K  2.0G   1% /dev
tmpfs          tmpfs     796M  1.1M  795M   1% /run
none           tmpfs     5.0M  4.0K  5.0M   1% /run/lock
none           tmpfs     2.0G  4.0M  2.0G   1% /run/shm
none           tmpfs     100M   68K  100M   1% /run/user
cgroup         tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda7      ext4      9.2G  3.3G  5.5G  38% /partition7
/dev/sda8      ext3       46G   43G  1.1G  98% /partition8
/dev/sda9      ext3       74G   51G   19G  74% /partition9
/dev/sda21     ext4       14G  7.7G  5.5G  59% /partition10
root@tuxworld:~# 

Example 4: Using -i option with df command

By using -i option along with df command ,print the inode information of filesystem.
As per my experience, I have seen the cases when inode become 100% in use. Whereas using df -h shown me some free space was available.
Note: Because of Inode use (IUse%) is 100%, many application stops working. Always remember this option for troubleshooting purpose.

See below given reference:

root@tuxworld:~# df -ih
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/sda5        1.8M  777K 1012K   44% /
udev             202K   696  201K    1% /dev
tmpfs            208K   733  207K    1% /run
none             208K     5  208K    1% /run/lock
none             208K    21  208K    1% /run/shm
none             208K    29  207K    1% /run/user
cgroup           208K     9  208K    1% /sys/fs/cgroup
/dev/sda7        597K   828  596K    1% /partition7
/dev/sda8        3.0M   13K  3.0M    1% /partition8
/dev/sda9        4.7M   11K  4.7M    1% /partition9
/dev/sda21       895K  221K  674K   25% /partition10
root@tuxworld:~#

Example 5: Using -t option with df command

When we use -t option with df command, we have to also define the type of filesystem we want to print on screen. Here, type of filesystem meaning is ext2,ext3,ext4,tmpfs,sysfs etc.

To understand -t option, I will show 2 sample references.

Reference 1: In this reference,I have used only -t option and want to print ext4 filesystem which are mounted.

root@tuxworld:~# df -t ext4
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda5       28835836 25781868   1589188  95% /
/dev/sda7        9614116  3439440   5686304  38% /partition7
/dev/sda21      14418416  8003400   5682600  59% /partition10
root@tuxworld:~# 

Reference 2: The command is same as we have seen in Reference 1. To make the output more user friendly we will use -h and -T .(Read above examples, to understand -h and -T options)

root@tuxworld:~# df -t ext4 -Th
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda5      ext4   28G   25G  1.6G  95% /
/dev/sda7      ext4  9.2G  3.3G  5.5G  38% /partition7
/dev/sda21     ext4   14G  7.7G  5.5G  59% /partition10
root@tuxworld:~# 

Example 6: Show all mounted filesystem including dummy filesystem

Using -a option with df command, prints all filesystems including dummy filesystem. Hence, by using -a option you can know what are the dummy filesystems are available in your system .
You can also use other options along with -a .

root@tuxworld:~# df -a
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda5       28835836 25781876   1589180  95% /
proc                   0        0         0    - /proc
sysfs                  0        0         0    - /sys
none                   0        0         0    - /sys/fs/fuse/connections
none                   0        0         0    - /sys/kernel/debug
none                   0        0         0    - /sys/kernel/security
udev             2025248        4   2025244   1% /dev
devpts                 0        0         0    - /dev/pts
tmpfs             814768     1052    813716   1% /run
none                5120        4      5116   1% /run/lock
none             2036912     3996   2032916   1% /run/shm
none              102400       68    102332   1% /run/user
cgroup           2036912        0   2036912   0% /sys/fs/cgroup
cgroup                 0        0         0    - /sys/fs/cgroup/cpuset
cgroup                 0        0         0    - /sys/fs/cgroup/cpu
cgroup                 0        0         0    - /sys/fs/cgroup/cpuacct
cgroup                 0        0         0    - /sys/fs/cgroup/memory
cgroup                 0        0         0    - /sys/fs/cgroup/devices
cgroup                 0        0         0    - /sys/fs/cgroup/freezer
cgroup                 0        0         0    - /sys/fs/cgroup/blkio
cgroup                 0        0         0    - /sys/fs/cgroup/perf_event
/dev/sda7        9614116  3439440   5686304  38% /partition7
/dev/sda8       48062440 44482732   1138232  98% /partition8
/dev/sda9       76896316 53361192  19628924  74% /partition9
/dev/sda21      14418416  8003400   5682600  59% /partition10
binfmt_misc            0        0         0    - /proc/sys/fs/binfmt_misc
gvfsd-fuse             0        0         0    - /run/user/linux/gvfs
root@tuxworld:~# 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.