[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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
# 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?
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.