16 understanding device mapper and LVM device names lvdisplay, pvscan, pvdisplay -m


The Device-mapper is a component of the linux kernel (since version 2.6) that supports logical volume management. It is required by LVM2 and EVMS. The original LVM (included in stock 2.4 kernels) does not use it.


Kernel over device mapper can communicate with LVM, LUKS, RAID

kernel -> device-mapper -> LVM,LUKS, RAID
kernel -> VFS(xfs, ext4)

device-mapper names:
/dev/dm-0
/dev/dm-1

above names could change, so we have mapper names
/dev/mapper/vg-lv --->symbolic name --> /dev/dm-0...n



lvdisplay - display attributes of a logical volume
[root@localhost /]# lvdisplay /dev/vgmyvg/lvmylv 
File descriptor 22 (socket:[27108]) leaked on lvdisplay invocation. Parent PID 3225: -bash
  --- Logical volume ---
  LV Path                /dev/vgmyvg/lvmylv
  LV Name                lvmylv
  VG Name                vgmyvg
  LV UUID                rw55aw-zT0Y-gORa-AXkx-twj5-K0HY-JvMVBz
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-08-02 16:46:54 -0400
  LV Status              available
  # open                 1
  LV Size                96.00 MiB
  Current LE             24
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
 
[root@localhost /]#

pvscan scans all supported LVM block devices in the system for physical volumes.
[root@localhost /]# pvscan
File descriptor 22 (socket:[27108]) leaked on pvscan invocation. Parent PID 3225: -bash
  PV /dev/sdb3   VG vgmyvg          lvm2 [96.00 MiB / 0    free]
  PV /dev/sda2   VG cl              lvm2 [19.00 GiB / 0    free]
  Total: 2 [19.09 GiB] / in use: 2 [19.09 GiB] / in no VG: 0 [0   ]
[root@localhost /]#


pvdisplay - display attributes of a physical volume 

[root@localhost /]# pvdisplay -m
File descriptor 22 (socket:[27108]) leaked on pvdisplay invocation. Parent PID 3225: -bash
  --- Physical volume ---
  PV Name               /dev/sdb3
  VG Name               vgmyvg
  PV Size               100.00 MiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              24
  Free PE               0
  Allocated PE          24
  PV UUID               Cxhik5-4hkZ-1JLA-3V0q-7mLS-cCYK-Q8vFXv
 
  --- Physical Segments ---
  Physical extent 0 to 23:
    Logical volume      /dev/vgmyvg/lvmylv
    Logical extents     0 to 23
 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               cl
  PV Size               19.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4863
  Free PE               0
  Allocated PE          4863
  PV UUID               WmnwtU-f4Wk-Co7D-Ouyx-mLUw-wy5U-PXV1sg
 
  --- Physical Segments ---
  Physical extent 0 to 511:
    Logical volume      /dev/cl/swap
    Logical extents     0 to 511
  Physical extent 512 to 4862:
    Logical volume      /dev/cl/root
    Logical extents     0 to 4350
 
[root@localhost /]#



Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all