https://drive.google.com/file/d/1WA7Z5d-jAj-XILihYJ87rn2dW28SoX2I/view?usp=sharing

1. Overview of LVM Components

Component Purpose Example
Physical Volume (PV) Raw storage (disk/partition) /dev/sda1, /dev/sdb
Volume Group (VG) Pool of PVs LinuxVG
Logical Volume (LV) Usable "partition" from VG /dev/LinuxVG/LinuxLV

✅ Benefits: Resize volumes online, combine disks, snapshot support.


2. Prepare Disks for LVM

Create LVM Partitions

# Partition /dev/sda
sudo fdisk /dev/sda

# In fdisk:
# n → p → 1 → [Enter] → +2G → t → 8e (Linux LVM)
# n → p → 2 → [Enter] → +3G → t → 8e
# w

sudo partprobe    # Reload partition table
lsblk             # Verify sda1, sda2

💡 Partition Type 8e: Marks partition as LVM (required for safety).


3. Create Physical Volumes (PVs)

Initialize PVs

sudo pvcreate /dev/sda1 /dev/sda2    # Initialize both partitions
sudo pvs                             # Brief PV info
sudo pvdisplay                       # Detailed PV info

⚠️ Warning: pvcreate erases data on the partition!


4. Create Volume Group (VG)

Pool PVs into a VG

sudo vgcreate LinuxVG /dev/sda1      # Start with sda1
sudo vgs                             # Brief VG info
sudo vgdisplay                       # Detailed VG info

Extend VG with Additional PV