LVM

Reading Time: < 1 minute

In this segment we are going to talk about Logical Volume Management.

Last Edit: 7/29/2022

root@nfs1:/home/user# vgs
  VG       #PV #LV #SN Attr   VSize   VFree
  host1-vg   1   2   0 wz--n-  57.21g  36.00m
  vgpool     1   2   0 wz--n- 931.51g 746.51g
vgcreate vg-03 /dev/sdc
lvcreate -L 100G -n iso2 vg-03
root@nfs1:/home/user# pvscan
  PV /dev/sdb5   VG host1-vg        lvm2 [57.21 GiB / 36.00 MiB free]
  PV /dev/sda    VG vgpool          lvm2 [931.51 GiB / 746.51 GiB free]
  Total: 2 [988.73 GiB] / in use: 2 [988.73 GiB] / in no VG: 0 [0   ]
root@nfs1:/mnt/lviso/Ubuntu# lvscan
  ACTIVE            '/dev/vg-03/iso2' [100.00 GiB] inherit
  ACTIVE            '/dev/vgpool/lvstore' [350.31 GiB] inherit
  ACTIVE            '/dev/vgpool/lvol2' [500.00 GiB] inherit

In this example we are going to “extend” volume group “vg-03” with logical volume “iso2”

root@nfs1:/# lvextend -L 500G /dev/vg-03/iso2
Size of logical volume vg-03/iso2 changed from 200.00 GiB (51200 extents) to 500.00 GiB (128000 extents).
Logical volume vg-03/iso2 successfully resized.
root@nfs2:/# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb3
  VG Name               ubuntu-vg
  PV Size               58.75 GiB / not usable 0
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              15040
  Free PE               7520
  Allocated PE          7520
  PV UUID               W6Vynr-ATbk-DHOo-68V9-6s9H-Znfj-gRuOKW

  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               vg00
  PV Size               <1.82 TiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              476799
  Free PE               169599
  Allocated PE          307200
  PV UUID               H70ala-v08H-ocez-5Qmq-HIpk-OdVq-aYtWxL

Semi Random Note:

root@nfs1:/# resize2fs /dev/mapper/vg--03-iso2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/vg--03-iso2 is mounted on /mnt/lviso; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 38
The filesystem on /dev/mapper/vg--03-iso2 is now 157286400 (4k) blocks long.
This entry was posted in Linux, Storage. Bookmark the permalink.