Storage‎ > ‎Storage-disk‎ > ‎

findmnt command useful examples

Thank you for visiting this page, this page has been update in another link findmnt command useful examples
 findmnt  will  list  all  mounted  filesytems  or  search  for  a  filesystem.   The  findmnt command is able to search in /etc/fstab, /etc/fstab.d, /etc/mtab or /proc/self/mountinfo.  If device or mountpoint is not given, all filesystems are shown.

 The command prints all mounted filesystems in the tree-like format by default. Here is it look like

$ findmnt
TARGET                       SOURCE                       FSTYPE      OPTIONS
/                            /dev/sdb2                    ext4        rw,relatime,barrier=1,data=ordered
├─/proc                      proc                         proc        rw,relatime
│ ├─/proc/bus/usb            /proc/bus/usb                usbfs       rw,relatime
│ └─/proc/sys/fs/binfmt_misc                              binfmt_misc rw,relatime
├─/sys                       sysfs                        sysfs       rw,relatime
├─/dev                       devtmpfs                     devtmpfs    rw,relatime,size=8157124k,nr_inodes=2039281,mode=755
│ ├─/dev/pts                 devpts                       devpts      rw,relatime,gid=5,mode=620,ptmxmode=000
│ └─/dev/shm                 tmpfs                        tmpfs       rw,relatime
├─/boot                      /dev/sdb1                    ext4        rw,relatime,barrier=1,data=ordered
├─/home                      /dev/sdb9                    ext4        rw,relatime,barrier=1,data=ordered
├─/opt                       /dev/sdb6                    ext4        rw,relatime,barrier=1,data=ordered
│ └─/opt/mirror              /etc/auto.mirror             autofs      rw,relatime,fd=6,pgrp=1911,timeout=600,minproto=5,maxproto=5,indirect
├─/tmp                       /dev/sdb8                    ext4        rw,relatime,barrier=1,data=ordered
├─/usr                       /dev/sdb5                    ext4        rw,relatime,barrier=1,data=ordered
├─/var                       /dev/sdb7                    ext4        rw,relatime,barrier=1,data=ordered
│ └─/var/lib/nfs/rpc_pipefs  sunrpc                       rpc_pipefs  rw,relatime
├─/data                      /dev/sdc1                    ext4        rw,relatime,barrier=1,data=ordered
└─/dcsunit07_lun4_5          /dev/mapper/dcsunit07_lun4_5 xfs         rw,relatime,delaylog,sunit=256,swidth=3072,noquota

       -s, --fstab
              Search in /etc/fstab and /etc/fstab.d.  The output is in the list format (see --list).

       -m, --mtab
              Search in /etc/mtab.  The output is in the list format (see --list).

       -k, --kernel
              Search in /proc/self/mountinfo.  The output is in the tree-like format.  This is the default.

$ findmnt -s
TARGET            SOURCE                                    FSTYPE OPTIONS
/                 UUID=8e37d096-4494-4a31-80df-e74b6a8c26e3 ext4  
/boot             UUID=e10dc5c0-c27a-4617-8945-daab6d597137 ext4  
/home             UUID=4442fda3-7149-4f78-b114-ac8820c51549 ext4  
/opt              UUID=3166aa04-d05e-4b32-a306-939679882090 ext4  
/tmp              UUID=63d12776-b54a-454e-b721-e92526980b3f ext4  
/usr              UUID=f2b734b2-2e14-44cd-a1c8-2421b7e4d1b7 ext4  
...

$ findmnt -m

TARGET                   SOURCE                       FSTYPE      OPTIONS
/                        /dev/sdb2                    ext4        rw
/proc                    proc                         proc        rw
/sys                     sysfs                        sysfs       rw
/dev/pts                 devpts                       devpts      rw,gid=5,mode=620
/dev/shm                 tmpfs                        tmpfs       rw
/boot                    /dev/sdb1                    ext4        rw
/home                    /dev/sdb9                    ext4        rw
...

Prints all ext4 file systems currently mounted
$ findmnt -t ext4
TARGET SOURCE    FSTYPE OPTIONS
/      /dev/sdb2 ext4   rw,relatime,barrier=1,data=ordered
/boot  /dev/sdb1 ext4   rw,relatime,barrier=1,data=ordered
...

prints swap defined in /etc/fstab

$ findmnt --fstab -t swap
TARGET SOURCE                                    FSTYPE OPTIONS
swap   UUID=8b13596f-3647-4289-b8ab-89ce31719e42 swap  

Prints mount point filesystems , currently mounted and defined in fstab
$ findmnt --target /
TARGET SOURCE    FSTYPE OPTIONS
/      /dev/sdb2 ext4   rw,relatime,barrier=1,data=ordered

$ findmnt --fstab /
TARGET SOURCE                                    FSTYPE OPTIONS
/      UUID=8e37d096-4494-4a31-80df-e74b6a8c26e3 ext4

Prints /etc/fstab filesystem and converts LABEL= and UUID=tags to the real device names
$  findmnt --fstab --evaluate /boot
TARGET SOURCE    FSTYPE OPTIONS
/boot  /dev/sdb1 ext4  

Prints only the mountpoint where the filesystem with label "/data" is mounted
# findmnt -n --raw --evaluate --output=target LABEL=/data
/data



Comments