Objective

Hands-on practice with logical volume management in a Linux environment.

Tools & Technologies

  • pvcreate
  • vgcreate
  • lvcreate
  • lvextend
  • resize2fs

Key Commands

pvcreate /dev/sdb
vgcreate vg0 /dev/sdb
lvcreate -L 10G -n lv_data vg0
lvextend -L +5G /dev/vg0/lv_data && resize2fs /dev/vg0/lv_data

Lab Steps

01
Physical Volumes

Initialize block devices as LVM physical volumes with pvcreate.

02
Volume Groups

Combine physical volumes into a volume group for pooled storage.

03
Logical Volumes

Create logical volumes from the VG pool with arbitrary sizes and names.

04
Online Resize

Extend a mounted filesystem online using lvextend and resize2fs.

Challenges Encountered

  • XFS volumes require xfs_growfs instead of resize2fs
  • Reducing LVM volumes risks data loss — always backup first

Key Takeaways

  • LVM adds a layer of abstraction enabling online resize and snapshots
  • pvdisplay, vgdisplay, lvdisplay show full metadata