Thursday, July 15, 2010

findmnt(8)

I released util-linux-ng 2.18 two weeks ago. There is many changes, for example completely new libmount (not stable API yet), new fsfreeze(8) and findmnt(8) utils and some important changes in fdisk(8).

From my point of view the most attractive for end users is findmnt(8). This new util is a command line interface to the libmount library, the util is able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo.

Default output (mounted filesystems):
$ findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda4 ext3 rw,noatime,errors=co
├─/proc /proc proc rw,relatime
│ ├─/proc/bus/usb /proc/bus/usb usbfs rw,relatime
│ ├─/proc/sys/fs/binfmt_misc none binfmt_m rw,relatime
│ └─/proc/fs/nfsd nfsd nfsd rw,relatime
├─/sys /sys sysfs rw,relatime
├─/dev udev devtmpfs rw,relatime,size=197
│ ├─/dev/pts devpts devpts rw,relatime,gid=5,mo
│ └─/dev/shm tmpfs tmpfs rw,relatime
├─/boot /dev/sda1 ext3 rw,noatime,errors=co
├─/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1
│ └─/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvf rw,nosuid,nodev,rela
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipe rw,relatime
├─/mnt/foo //sr.net.home/foo cifs rw,relatime,mand,unc
└─/mnt/test /dev/sda6 btrfs rw,relatime
Get info about a mountpoint:
$ findmnt /home/kzak
TARGET SOURCE FSTYPE OPTIONS
/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered
Get all mounted extN filesystems:
$ findmnt -t ext4,ext3
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda4 ext3 rw,noatime,errors=continue,user_xattr
/boot /dev/sda1 ext3 rw,noatime,errors=continue,user_xattr
/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered
The same thing, but from fstab:
$ findmnt --fstab -t ext4,ext3
TARGET SOURCE FSTYPE OPTIONS
/ UUID=d3a8f783-df75-4dc8-9163-975a891052c0 ext3 noatime,defaults
/boot UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe ext3 noatime,defaults
/home/kzak /dev/mapper/kzak-home ext4 noatime,defaults
Don't like LABLEs/UUIDs?
$ findmnt --fstab --evaluate -t ext4,ext3
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda4 ext3 noatime,defaults
/boot /dev/sda1 ext3 noatime,defaults
/home/kzak /dev/mapper/kzak-home ext4 noatime,defaults
or convert UUID to mountpoint:
$ findmnt -o TARGET --noheadings UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
/boot

No comments:

Post a Comment