LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 03-11-2017, 08:46 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
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.
 
Old 03-11-2017, 10:37 PM   #2
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Try df -lh
 
Old 03-11-2017, 11:06 PM   #3
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doug G View Post
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.
 
Old 03-11-2017, 11:12 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,841

Rep: Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008Reputation: 4008
Quote:
Originally Posted by fanoflq View Post
/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 ?.
 
Old 03-11-2017, 11:53 PM   #5
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
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?
 
Old 03-12-2017, 10:12 AM   #6
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan with some Tiny Core, Fatdog, Haiku, & BSD thrown in.
Posts: 5,020

Rep: Reputation: Disabled
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.
 
Old 03-12-2017, 10:35 AM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,716

Rep: Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192
Quote:
Originally Posted by fanoflq View Post
#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.
Old 03-12-2017, 10:39 AM   #8
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
fanoflq - rknichols' (post #7) suggested command would be mine as well.

Cheers,
 
Old 03-12-2017, 03:22 PM   #9
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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?
 
Old 03-12-2017, 04:02 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,716

Rep: Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192
Quote:
Originally Posted by fanoflq View Post
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.
Old 03-12-2017, 04:37 PM   #11
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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.
 
Old 03-12-2017, 05:04 PM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,716

Rep: Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192Reputation: 2192
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.
Old 03-12-2017, 05:36 PM   #13
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Display Paticular Mount point pvsarat Linux - Newbie 9 08-29-2013 07:41 AM
Shell script to display Read Only (ro) mount point in Linux monty_0309 Linux - Newbie 5 01-14-2012 10:25 AM
command to display the device-fs-uuid-mount point htamayo Linux - Newbie 2 10-26-2010 02:44 PM
mount point for new partition bluefishkiller Linux - Desktop 2 07-16-2007 01:58 PM
More than one mount point on one partition? essdeeay Linux - General 3 02-22-2006 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration