[SOLVED] Command to display mount point vs partition
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
# I like to find out for a given mount point (directory)
# what is its associated device.
#So I use command mount.
Code:
[root@Centos7 ~]# mount | grep -i /dev/
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
/dev/mapper/centos-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/dev/vda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
# But mount command does not tell me everything.
# For instance, device /dev/mapper/centos-root is mounted on /
# but I still have to use lsblk to look up its device partition
# associated with mount point / (root).
Code:
[root@Centos7~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 14G 0 disk
├─vda1 252:1 0 500M 0 part /boot
└─vda2 252:2 0 11G 0 part
├─centos-root 253:0 0 10G 0 lvm /
└─centos-swap 253:1 0 1G 0 lvm
#Is there a command that would be more "direct",
as in combining result of mount and lsblk for storage partitions?
That command, if it exists, would print out a mount point versus partiton table.
/dev/mapper/centos-root is a mount point associated with a LVM partition.
Wrong.
It's a lv - the equivalent to a partition. Except that it may span multiple partitions across multiple devices. How do you plan to accommodate that ?.
Wrong.
It's a lv - the equivalent to a partition. Except that it may span multiple partitions across multiple devices. How do you plan to accommodate that ?.
I am not able to understand your question.
Can you rephrase it?
Distribution: Mainly Devuan with some Tiny Core, Fatdog, Haiku, & BSD thrown in.
Posts: 5,020
Rep:
If you have logical volumes, data may be on any of the disks within that volume, therefore, it will be nigh on impossible to say where any particular directory will be.
#Is there a command that would be more "direct",
as in combining result of mount and lsblk for storage partitions?
That command, if it exists, would print out a mount point versus partiton table.
I am using CentOS 7, as VMs, but I do not get
parenthesis like (dm-1), (dm-2), .... for lsblk -f.
How did you do that?
That does not appear to be available in CentOS 7. The output I showed was from CentOS 6, where the "dm-*" device appears automatically as part of the "NAME" column. You can get that same information by including "-o MAJ:MIN" in the options. The mapper devices will have major device number 253.
That does not appear to be available in CentOS 7. The output I showed was from CentOS 6, where the "dm-*" device appears automatically as part of the "NAME" column. You can get that same information by including "-o MAJ:MIN" in the options. The mapper devices will have major device number 253.
Notice the major device number are the same for vda1,vda2, vdb1, vdb2,....vdb7.
I do not understand why they are the same since their UUID will be different.
Major device number is the device type. It determines what driver to use. In this case, major device 252 is for the virtio disk driver. The minor device number tells what physical device and partition, with the device index in the high-order bits and the partition number in the low-order 4 bits. (More than 15 partitions would cause another major device number to be assigned for that driver.)
Mount and df are normally simple ways to find partitions and mount points. But there's many filesystems now, and some have built in software raid type abilities that can span several partitions and devices and have special tools to inspect and manage them. Which can report partially/obscurely in mount and df, depending on how the things are used. And your versions of things.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.