Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
03-11-2017, 08:46 PM
|
#1
|
Member
Registered: Nov 2015
Posts: 397
Rep: 
|
Command to display mount point vs partition
I read this 6-7 years old post:
http://www.linuxquestions.org/questi...-point-840589/
May be there is a new command by now....
# 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.
|
|
|
03-11-2017, 10:37 PM
|
#2
|
Member
Registered: Jul 2013
Posts: 749
Rep: 
|
Try df -lh
|
|
|
03-11-2017, 11:06 PM
|
#3
|
Member
Registered: Nov 2015
Posts: 397
Original Poster
Rep: 
|
Quote:
Originally Posted by Doug G
Try df -lh
|
For mount point with LVM device type partition,
you still cannot see the associated device using df -lh:
Code:
[root@Centos7-1024ram-minimal ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 10G 1.1G 9.0G 11% /
devtmpfs 487M 0 487M 0% /dev
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 497M 6.6M 490M 2% /run
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/vdb1 97M 5.2M 92M 6% /mnt/mnt1
/dev/vda1 497M 125M 373M 26% /boot
tmpfs 100M 0 100M 0% /run/user/0
/dev/mapper/centos-root is a mount point
associated with a LVM partition.
|
|
|
03-11-2017, 11:12 PM
|
#4
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,414
|
Quote:
Originally Posted by fanoflq
/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 ?.
|
|
|
03-11-2017, 11:53 PM
|
#5
|
Member
Registered: Nov 2015
Posts: 397
Original Poster
Rep: 
|
Quote:
Originally Posted by syg00
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?
|
|
|
03-12-2017, 10:12 AM
|
#6
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,914
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.
|
|
|
03-12-2017, 10:35 AM
|
#7
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,827
|
Quote:
Originally Posted by fanoflq
#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.
|
Perhaps lsblk with the "-f" option?
Code:
# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
├─sdb1 LVM2_member VClkvH-j3nU-8TgQ-tSKv-afui-wWcA-QzFbbN
│ └─vg_omega3g-var (dm-1) ext4 3g-var bd364302-bd49-4a05-93dc-69e05f3d33a0 /var
├─sdb2
├─sdb3 LVM2_member I5EdxQ-Dxau-IIeB-XyVN-RJVP-MMVq-n91kyS
│ ├─vg_omega3g-srvlv (dm-4) ext4 :/srv 5b0c75f2-8542-42df-ad1a-167a9ba82552 /srv
│ └─vg_omega3g-swap01 (dm-5)
│ └─swap01 (dm-7) swap 9c26aca8-21a5-4638-98a1-26cfafee93ef [SWAP]
└─sdb4
sdc
├─sdc1 crypto_LUKS 683b79ea-df36-4678-99fd-5f39f54e2d91
└─sdc2 crypto_LUKS 4680789a-d07f-46dc-a325-2c24198ecea3
sda
├─sda1 ext4 3g-boot a711e711-8e68-479d-8653-02b66784137e /boot
└─sda2 LVM2_member JkshSd-Fjaf-Q0GY-tYMe-u62n-Dndx-WqENZC
├─vg_omega3g-rootvol (dm-0) ext4 3g-root bfc1deca-9cd9-4207-9a80-c6df75a9fafe /
├─vg_omega3g-virt (dm-2) ext4 3g-libvirt 510a766f-f29e-4822-9cad-04e932ed0149 /var/lib/libvirt
└─vg_omega3g-swap00 (dm-3)
└─swap00 (dm-6) swap 8a493e45-90d3-49f6-874e-968a9f4b59f3 [SWAP]
sr0
|
|
2 members found this post helpful.
|
03-12-2017, 10:39 AM
|
#8
|
Senior Member
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
|
fanoflq - rknichols' (post #7) suggested command would be mine as well.
Cheers,
|
|
|
03-12-2017, 03:22 PM
|
#9
|
Member
Registered: Nov 2015
Posts: 397
Original Poster
Rep: 
|
Quote:
Originally Posted by rknichols
Perhaps lsblk with the "-f" option?
Code:
# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
├─sdb1 LVM2_member VClkvH-j3nU-8TgQ-tSKv-afui-wWcA-QzFbbN
│ └─vg_omega3g-var (dm-1) ext4 3g-var bd364302-bd49-4a05-93dc-69e05f3d33a0 /var
├─sdb2
├─sdb3 LVM2_member I5EdxQ-Dxau-IIeB-XyVN-RJVP-MMVq-n91kyS
│ ├─vg_omega3g-srvlv (dm-4) ext4 :/srv 5b0c75f2-8542-42df-ad1a-167a9ba82552 /srv
│ └─vg_omega3g-swap01 (dm-5)
│ └─swap01 (dm-7) swap 9c26aca8-21a5-4638-98a1-26cfafee93ef [SWAP]
└─sdb4
sdc
├─sdc1 crypto_LUKS 683b79ea-df36-4678-99fd-5f39f54e2d91
└─sdc2 crypto_LUKS 4680789a-d07f-46dc-a325-2c24198ecea3
sda
├─sda1 ext4 3g-boot a711e711-8e68-479d-8653-02b66784137e /boot
└─sda2 LVM2_member JkshSd-Fjaf-Q0GY-tYMe-u62n-Dndx-WqENZC
├─vg_omega3g-rootvol (dm-0) ext4 3g-root bfc1deca-9cd9-4207-9a80-c6df75a9fafe /
├─vg_omega3g-virt (dm-2) ext4 3g-libvirt 510a766f-f29e-4822-9cad-04e932ed0149 /var/lib/libvirt
└─vg_omega3g-swap00 (dm-3)
└─swap00 (dm-6) swap 8a493e45-90d3-49f6-874e-968a9f4b59f3 [SWAP]
sr0
|
Good suggestion.
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?
|
|
|
03-12-2017, 04:02 PM
|
#10
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,827
|
Quote:
Originally Posted by fanoflq
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.
|
|
1 members found this post helpful.
|
03-12-2017, 04:37 PM
|
#11
|
Member
Registered: Nov 2015
Posts: 397
Original Poster
Rep: 
|
Quote:
Originally Posted by rknichols
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.
|
Thank you.
I ran this:
Code:
[root@Centos7-1024ram-minimal centos]# lsblk -o NAME,FSTYPE,LABEL,MAJ:MIN,MOUNTPOINT,UUID
NAME FSTYPE LABEL MAJ:MIN MOUNTPOINT UUID
sr0 11:0
vda 252:0
├─vda1 xfs 252:1 /boot 8d34de35-0bb4-4ae0-ba32-4a0cb16e3892
└─vda2 LVM2_member 252:2 PzK74b-owV4-82Eq-q0Lc-YsZx-Jo4c-1MTBex
├─centos-root xfs 253:0 / 18439a4b-48a6-4271-b033-4b02c7127e2e
└─centos-swap swap 253:1 5b2eca97-8c3a-4402-9086-5f62437ecb7b
vdb 252:16
├─vdb1 xfs 252:17 /mnt/mnt1 de22f78a-0120-4674-8dea-206124985585
├─vdb2 252:18
├─vdb5 252:21
├─vdb6 252:22
└─vdb7 252:23
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.
|
|
|
03-12-2017, 05:04 PM
|
#12
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,827
|
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.)
|
|
1 members found this post helpful.
|
03-12-2017, 05:36 PM
|
#13
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
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.
|
|
|
All times are GMT -5. The time now is 09:09 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|