https://drive.google.com/file/d/1_pwHYDWIArV15PQqbrze8McoxVp-2Quk/view?usp=sharing

1. Initial Setup: Create LVM with Two Disks

Add Disks and Partition

# Partition /dev/sda (3GB)
sudo fdisk /dev/sda
# Commands: n → p → 1 → [Enter] → +3G → t → 8e → w

# Partition /dev/sdb (2GB)
sudo fdisk /dev/sdb
# Commands: n → p → 1 → [Enter] → +2G → t → 8e → w

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

Create Physical Volumes (PVs)

sudo pvcreate /dev/sda1 /dev/sdb1
sudo pvs          # Should show both PVs (3G + 2G = 5G total)

Create Volume Group (VG)

sudo vgcreate zybi_vg /dev/sda1 /dev/sdb1
sudo vgs          # Verify VG size (~4.99G usable)

Create Logical Volume (LV)

sudo lvcreate -L 4G -n zybi_lv zybi_vg
sudo lvs          # Verify 4G LV

💡 Note: Your original command had reversed paths—correct LV path is:

/dev/zybi_vg/zybi_lv (not /dev/zybi_lv/zybi_vg)


2. Format and Mount LV

Correct Commands

# Format
sudo mkfs.ext4 /dev/zybi_vg/zybi_lv

# Mount
sudo mkdir /testdir
sudo mount /dev/zybi_vg/zybi_lv /testdir

# Test data
cd /testdir
touch test{1..20}
cal > cal.txt
cd


3. Extend LVM (Online Resize)

Extend by 1000MB (1GB)

# Check current size
df -hT /testdir

# Extend LV (+1GB)
sudo lvextend -L +1000M /dev/zybi_vg/zybi_lv

# Resize filesystem (ext4)
sudo resize2fs /dev/zybi_vg/zybi_lv

# Verify
df -hT /testdir    # Should show ~5G total