Intermediate LevelLinux Commands & SysAdmin
What is Logical Volume Management (LVM) and how do PV, VG, and LV components work?
❓ Interview Prompt: Explain LVM architecture, Physical Volumes (pvcreate), Volume Groups (vgcreate), Logical Volumes (lvcreate), and dynamic filesystem expansion.
LVM (Logical Volume Management) abstracts physical hard drives into flexible, dynamically resizable storage pools:
Three Architecture Layers:
1
Physical Volume (PV): Raw disk partitions formatted for LVM ('pvcreate /dev/sdb1').
2
Volume Group (VG): Storage pool combining multiple PVs ('vgcreate data_vg /dev/sdb1 /dev/sdc1').
3
Logical Volume (LV): Virtual storage partition allocated from VG ('lvcreate -L 50G -n app_lv data_vg'), which is formatted with a filesystem and mounted!
Code Implementation Example
bash
# 1. Initialize Physical Volume
sudo pvcreate /dev/sdb1
# 2. Create Volume Group pool
sudo vgcreate vg_storage /dev/sdb1
# 3. Create 100GB Logical Volume
sudo lvcreate -L 100G -n lv_data vg_storage
# 4. Extend Logical Volume dynamically while online
sudo lvextend -L +50G /dev/vg_storage/lv_data
sudo resize2fs /dev/vg_storage/lv_data💡Creating and dynamically extending LVM Logical Volumes online.
🎯 Interview Key Takeaway
Use LVM to enable dynamic online storage expansion without downtime or unmounting filesystems.
#LVM#Logical Volumes#Storage#Intermediate
Back to all Linux Commands & SysAdmin Questions→