DevOps Discussion Forum
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)


Exclamation  Problem

Filesystem (e.g. /, /var) is running out of space and needs to be extended.


 Step 1 — Check Current Disk Usage

Code:
df -h
Output:
Code:
/dev/mapper/rootvg-varlv    14G  13G  1.4G  91% /var

Outcome:
  • Identify which mount point is full (e.g /var)
  • This determines which LV needs extension


 Step 2 — Verify LVM Setup (Build Context for Extension)

  1. Map LV to Mount Point

Code:
lsblk
Output :
Code:
NAME              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                8:0    0  256G  0 disk
├─sda4              8:4    0 63.3G  0 part
  ├─rootvg-varlv  253:3    0  14G  0 lvm  /var

└─sda5              8:5    0  100G  0 part
  ├─rootvg-varlv  253:3    0  14G  0 lvm  /var

Idea  Insight:
  • Identifies which LV is mounted where
  • Confirms LVM usage (TYPE = lvm)

  2. Identify Target LV

Code:
lvs -o lv_name,vg_name,lv_path
Output:
Code:
LV    VG    Path
varlv  rootvg /dev/rootvg/varlv

Idea  Insight:
  • Confirms exact LV name to extend (e.g varlv)
  • Provides correct device path required for lvextend (e.g  /dev/rootvg/varlv)

  3. Check Available Space in VG 

Code:
vgs
Output:
Code:
VG    #PV #LV #SN Attr  VSize    VFree
rootvg  2  5  0 wz--n- <163.31g 316.00m

Idea Insight:
  • Determines if extension is possible

       Interpretation:
  • VFree > 0
    → Extend directly
  • VFree = 0
    → Add disk first

  4. Check Underlying Disks

Code:
pvs
Code:
PV        VG    Fmt  Attr PSize    PFree
/dev/sda4  rootvg lvm2 a--  63.31g    0
/dev/sda5  rootvg lvm2 a--  <100.00g 316.00m

Idea  Insight:
  • Shows disks backing the VG
  • Confirms whether storage is already fully utilized


Cool  Step 2 Outcome (What we now know)
  • Which LV to extend (varlv)
  • Its mount point (/var) and exact path (/dev/rootvg/varlv)
  • Whether free space exists in VG
  • Which disks are backing LVM



Exclamation  Decision Point

Case 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
  • -L → size in GB/MB

OR use all free space:

Code:
lvextend -l +100%FREE /dev/rootvg/varlv
  • -l → extents / percentage

Outcome:

Code:
Size of logical volume rootvg/varlv changed from 14.00 GiB (3584 extents) to <14.31 GiB (3663 extents).
Logical volume rootvg/varlv successfully resized.
  • LV size increases
  • Filesystem unchanged (IMPORTANT)



   Step 4 — Resize Filesystem

Check filesystem:

Code:
lsblk -f

For ext4:

Code:
resize2fs /dev/rootvg/varlv

For xfs:

Code:
xfs_growfs /var

Outcome:
  • Filesystem expands to use new space



  Step 5 — Verify

Code:
df -h


Case B — No Free Space in VG

  Step 3 — Add New Disk (Cloud / VM level)
  • Add a new disk from your cloud provider / hypervisor (e.g. AWS, Azure, VMware)
  • Example: New disk appears as /dev/sdb
  • Verify Disk is Added
    Code:
    lsblk
  • New disk should be visible (e.g. /dev/sdb)


  Step 4 — Create PV

Code:
pvcreate /dev/sdb


  Step 5 — Extend VG

Code:
vgextend rootvg /dev/sdb


  Step 6 — Extend LV

Code:
lvextend -l +100%FREE /dev/rootvg/varlv


  Step 7 — Resize Filesystem

Code:
xfs_growfs /var

# OR

Code:
resize2fs /dev/rootvg/varlv


  Step 8 — Verify

Code:
df -h



 Additional Note — Expanding Existing Disk

If the same disk is increased in size (no new disk added):

Code:
growpart /dev/sda 4
Code:
pvresize /dev/sda4

Outcome:
  • growpart → expands the partition
  • pvresize → makes new space available to LVM

 You can now proceed with lvextend




Exclamation Common Mistakes
  • Extending LV but not resizing filesystem
  • Using wrong filesystem command (resize2fs vs xfs_growfs)
  • Not checking vgs before starting
  • Using wrong device path
  • Confusing disk (/dev/sdb) with LV (/dev/rootvg/varlv)



Huh  Key Concepts and Takeaways
  • PV (Physical Volume) → Disk (/dev/sda4)
  • VG (Volume Group) → Storage pool (rootvg)
  • LV (Logical Volume) → Usable volume (/var)

Flow:
Disk → PV → VG → LV → Filesystem
  • Extension = LV resize + filesystem resize
  • vgs decides your approach (direct vs add disk)
  • LVM allows online resizing (no downtime)



Exclamation  Precautions
  • Take backup before changes
  • Double-check device names
  • Run carefully on production