![]() |
|
Extending LVM Logical Volume (LV) in Linux – Runbook - Printable Version +- DevOps Discussion Forum (https://forums.geekssolutions.io) +-- Forum: Cloud Computing (https://forums.geekssolutions.io/forumdisplay.php?fid=10) +--- Forum: Linux (https://forums.geekssolutions.io/forumdisplay.php?fid=19) +--- Thread: Extending LVM Logical Volume (LV) in Linux – Runbook (/showthread.php?tid=28) |
Extending LVM Logical Volume (LV) in Linux – Runbook - Kalyani - 04-22-2026 Purpose Extend disk space on a Linux system using LVM without downtime. Applies to Systems using LVM (Logical Volume Manager) ProblemFilesystem (e.g. /, /var) is running out of space and needs to be extended. Step 1 — Check Current Disk Usage Code: df -hCode: /dev/mapper/rootvg-varlv 14G 13G 1.4G 91% /varOutcome:
Step 2 — Verify LVM Setup (Build Context for Extension) 1. Map LV to Mount Point Code: lsblkCode: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS Insight:
Code: lvs -o lv_name,vg_name,lv_pathCode: LV VG Path Insight:
Code: vgsCode: VG #PV #LV #SN Attr VSize VFree Insight:
Interpretation:
4. Check Underlying Disks Code: pvsCode: PV VG Fmt Attr PSize PFree Insight:
Step 2 Outcome (What we now know)
Decision PointCase A: VG has free space → Extend LV directly Case B: No free space → Add disk / extend storage first Case A — Extend LV (VG has free space) Step 3 — Extend Logical Volume Code: lvextend -L +316M /dev/rootvg/varlv
OR use all free space: Code: lvextend -l +100%FREE /dev/rootvg/varlv
Outcome: Code: Size of logical volume rootvg/varlv changed from 14.00 GiB (3584 extents) to <14.31 GiB (3663 extents).
Step 4 — Resize Filesystem Check filesystem: Code: lsblk -fFor ext4: Code: resize2fs /dev/rootvg/varlvFor xfs: Code: xfs_growfs /varOutcome:
Step 5 — Verify Code: df -hCase B — No Free Space in VG Step 3 — Add New Disk (Cloud / VM level)
Step 4 — Create PV Code: pvcreate /dev/sdbStep 5 — Extend VG Code: vgextend rootvg /dev/sdbStep 6 — Extend LV Code: lvextend -l +100%FREE /dev/rootvg/varlvStep 7 — Resize Filesystem Code: xfs_growfs /var# OR Code: resize2fs /dev/rootvg/varlvStep 8 — Verify Code: df -hAdditional Note — Expanding Existing Disk If the same disk is increased in size (no new disk added): Code: growpart /dev/sda 4Code: pvresize /dev/sda4Outcome:
You can now proceed with lvextend Common Mistakes
Key Concepts and Takeaways
Flow: Disk → PV → VG → LV → Filesystem
Precautions
|