Linux Commands to Check Mounted Files on the System
The common commands to check the mounted devices is the mount command. It can also mount and unmount them whenever needed. In this tutorial, we will discuss about a command similar to the mount command which is called findmnt.
Installation of findmnt
The command can be found in the package util-linux which is installed by default on most of the distributions.
$ aptitude search util-linux
i util-linux – Miscellaneous system utilities
1) Listing the file system
findmnt
We can view the files system mounted in our system in the form of a tree model by simply typing the command findmnt.
2) Files system in a list format
findmnt –l
The same tree style output of the mounted files system can be listed out without any model, by using the option l.
3) Listing the system in df format
The output of findmnt command can be listed in the format of df command output with the help of the option -D or –df.
# findmnt –D
SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
devtmpfs devtmpfs 887.1M 0 887.1M 0% /dev
tmpfs tmpfs 896M 0 896M 0% /dev/shm
tmpfs tmpfs 896M 86.7M 809.3M 10% /run
tmpfs tmpfs 896M 0 896M 0% /sys/fs/cgroup
/dev/vda3 ext4 46.4G 3G 41.3G 6% /
/dev/vda1 ext4 476.2M 233.1M 214.1M 49% /boot
tmpfs tmpfs 179.2M 0 179.2M 0% /run/user/0
4) fstab output list
File system information can be fetched from /etc/fstab file and /etc/fstab.d directory only by using the option –s or –fstab.
findmnt -s
TARGET SOURCE FSTYPE OPTIONS
/ /dev/vda3 ext4 defaults
/boot /dev/vda1 ext4 defaults
swap /dev/vda2 swap defaults
5) Filter out file system
We can filter out the file system required or if more than one files system is needed then separate it by a comma. In the given example, we have filtered ext 4 file system.
findmnt -t ext4
TARGET SOURCE FSTYPE OPTIONS
/ /dev/vda3 ext4 rw, relatime, data=ordered
└─/boot /dev/vda1 ext4 rw, relatime, data=ordered
6) RAW OUTPUT
findmnt –raw
The findmnt output can be displayed in a random fashion using the option –r or –raw.
7) Search with source device
File system can be filtered out with respect to the source device using the option –S.
findmnt -S /dev/vda3
TARGET SOURCE FSTYPE OPTIONS
/ /dev/vda3 ext4 rw, relatime, data=ordered
8) Search by mount point
Searching the file system with respect to the mount directory can be done with option ‘-T’/’–target’.
findmnt -T /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/vda3 ext4 rw, relatime, data=ordered
If you need any further assistance please contact our support department.