How are logical volumes like /dev/dm-0 mapped to /dev/sdx disks/partitions ?

Display volume manager devices
#  dmsetup ls --tree -o device
vg_oel64-lv_swap (252:1)
 ├─ (8:3)                         <-- Major, Minor number from /dev/sdX 
 └─ (8:2)
vg_oel64-lv_root (252:0)
 └─ (8:2)

Check /dev/mapper 
# ls -l  /dev/mapper/vg*
lrwxrwxrwx. 1 root root 7 Mar 24 09:07 /dev/mapper/vg_oel64-lv_root -> ../dm-0
lrwxrwxrwx. 1 root root 7 Mar 24 09:07 /dev/mapper/vg_oel64-lv_swap -> ../dm-1

Display physical VG
# pvs
  PV         VG       Fmt  Attr PSize  PFree
  /dev/sda2  vg_oel64 lvm2 a--  40.34g    0
  /dev/sda3  vg_oel64 lvm2 a--   6.04g 3.04g

Display logical volumes
# lvdisplay /dev/mapper/vg_oel64-lv_swap
  --- Logical volume ---
  LV Path                /dev/vg_oel64/lv_swap
  LV Name                lv_swap
  VG Name                vg_oel64
# lvdisplay /dev/mapper/vg_oel64-lv_root
  --- Logical volume ---
  LV Path                /dev/vg_oel64/lv_root
  LV Name                lv_root
  VG Name                vg_oel64

Match major/minor number returned from above dmsetup output
# ls -l /dev/sda2 /dev/sda3
brw-rw----. 1 root disk 8, 2 Mar 24 09:07 /dev/sda2
brw-rw----. 1 root disk 8, 3 Mar 24 09:07 /dev/sda3

--> Swap volume vg_oel64-lv_swap is mapped  to /dev/sda2 and /dev/sda3 partitions
    Root volume vg_oel64-lv_root is only mapped to /dev/sda2
    Both logical volumes are using phy. VG vg_oel64

Leave a Reply

Your email address will not be published. Required fields are marked *