A complete solution of using findmnt command in Linux system

Time:2021-2-20

The findmnt command is used to find the mounted file system. It is a part of util Linux package. It is used to list the installation devices and mount or uninstall them when necessary.

Install findmnt
The findmnt command comes from the util Linux package and is installed by default in most distributions, such as Ubuntu, Fedora and Debian

Copy code

The code is as follows:

$ aptitude search util-linux
i util-linux – Miscellaneous system utilities

$ yum info util-linux

Basic use

Copy code

The code is as follows:

$ findmnt

20151029120330871.png (864×628)

Output in list format.

Copy code

The code is as follows:

$ findmnt -l

20151029120358419.png (1316×539)

Lists the file systems mounted in fstab.

Copy code

The code is as follows:

$ findmnt -s

20151029120414959.png (808×107)

Lists mounted file systems by file type.

Copy code

The code is as follows:

$ findmnt -t ext4

20151029120431079.png (1031×61)

DF format output
Findmnt can use the “- D” or “- DF” options to create a DF format output report of free and used disk space.

Copy code

The code is as follows:

$ findmnt -D
SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
devtmpfs devtmpfs 994.2M 0 994.2M 0% /dev
selinuxfs selinuxfs 0 0 0 – /sys/fs/selinux
tmpfs tmpfs 1001.5M 68K 1001.4M 0% /dev/shm
tmpfs tmpfs 1001.5M 724K 1000.8M 0% /run
tmpfs tmpfs 1001.5M 0 1001.5M 0% /sys/fs/cgroup
/dev/mapper/fedora-root ext4 6.5G 5.3G 811.6M 82% /
tmpfs tmpfs 1001.5M 60K 1001.5M 0% /tmp
/dev/sda1 ext4 476.2M 107.7M 339.6M 23% /boot

Raw output
If you like raw style output, use the “- R” or “- raw” options.

Copy code

The code is as follows:

$ findmnt –raw
TARGET SOURCE FSTYPE OPTIONS
/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
/proc proc proc rw,nosuid,nodev,noexec,relatime
/dev udev devtmpfs rw,relatime,size=4069060k,nr_inodes=1017265,mode=755
/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
/run tmpfs tmpfs rw,nosuid,noexec,relatime,size=816716k,mode=755
/ /dev/disk/by-uuid/6fa5a72a-ba26-4588-a103-74bb6b33a763 ext4 rw,relatime,errors=remount-ro,data=ordered
/sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755
/sys/fs/fuse/connections fusectl rw,relatime
/sys/kernel/debug debugfs rw,relatime
/sys/kernel/security securityfs rw,relatime
/run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k
/run/shm tmpfs rw,nosuid,nodev,relatime
/run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755
/sys/fs/pstore pstore rw,relatime
/media/13f35f59-f023-4d98-b06f-9dfaebefd6c1 /dev/sda8 ext4 rw,nosuid,nodev,relatime,errors=remount-ro,data=ordered
/media/4668484A68483B47 /dev/sda5 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/proc/sys/fs/binfmt_misc binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime
/sys/fs/cgroup/systemd systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd
/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000

Find by source device
Find the file system through the source device, and specify the device path, including / excluding the “- s” option.

Copy code

The code is as follows:

$ findmnt -S /dev/sda1
TARGET SOURCE FSTYPE OPTIONS
/boot /dev/sda1 ext4 rw,relatime,seclabel,data=ordered

Search by mount point
Find the file system through the mount directory, and specify the directory to include / exclude the “- t / — target” option.

Copy code

The code is as follows:

$ findmnt -T /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/fedora-root ext4 rw,relatime,seclabel,data=ordered

$ findmnt -T /media/4668484A68483B47
TARGET SOURCE FSTYPE OPTIONS
/media/4668484A68483B47 /dev/sda5 fuseblk rw,nosuid,nodev,relatime,user_id=0

Recommended Today

Background management system menu management module

1 menu management page design 1.1 business design Menu management, also known as resource management, is the external manifestation of system resources. This module is mainly to add, modify, query and delete the menu. CREATE TABLE `sys_menus` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Name ` varchar (50) default null comment ‘resource name’, `URL ` varchar […]