Skip to content

Ubuntu — Extend an LVM Volume

Two common scenarios:

  • Scenario A — the volume group already has unallocated free space (common after Ubuntu's default install, or after extending a VM disk in Proxmox/VMware)
  • Scenario B — you are adding a new disk and need to grow the volume group first

How LVM Works

LVM stacks three layers between your disks and your filesystem, and every command in this guide operates on exactly one of them:

Disk/Partition ──► PV (Physical Volume) ──► VG (Volume Group) ──► LV (Logical Volume) ──► Filesystem
  • PV — a disk or partition handed over to LVM (pvcreate, pvresize)
  • VG — a pool made of one or more PVs; this is where free space lives (vgextend)
  • LV — a slice of the VG that behaves like a partition (lvextend)
  • Filesystem — ext4/XFS on top of the LV; it does not grow automatically with the LV (resize2fs / xfs_growfs, or lvextend -r to do both at once)

Growing always means: make sure the layer below has space, then extend upward. Scenario A starts at the LV (the VG already has space); Scenario B starts at the PV (a new disk enters the pool). The most common mistake — extending the LV and wondering why df -h shows nothing — is a forgotten filesystem resize, the top layer.


Pre-requisites

  • Ubuntu with LVM (default for Ubuntu Server installs)
  • sudo access
  • For Scenario B: new disk attached and visible (lsblk)

1. Check Current State

One command per layer — lsblk for disks, pvs/vgs/lvs for the three LVM layers, df -h for the filesystem:

lsblk
sudo pvs
sudo vgs
sudo lvs
df -h

Key things to look for in vgs output:

  VG        #PV #LV #SN Attr   VSize   VFree
  ubuntu-vg   1   1   0 wz--n- <99.00g 49.00g

VFree shows unallocated space in the VG — if it's non-zero, you are in Scenario A.


Scenario A — Free Space Already in the VG

This is the most common case. Ubuntu's installer often leaves half the VG unallocated.

Extend and resize in one command

sudo lvextend -l +100%FREE -r /dev/ubuntu-vg/ubuntu-lv

The -r flag resizes the filesystem automatically. Done.

Or: two separate steps

ext4:

sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

XFS (use mountpoint, not device):

sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo xfs_growfs /

Find your LV path

Not sure of the exact path? sudo lvdisplay shows the LV Path for each volume.


Scenario B — Adding a New Disk

Use this when VFree is 0 and you need more underlying storage.

1. Identify the new disk

lsblk

Look for an unpartitioned disk (e.g. /dev/sdb with no children).

sudo fdisk /dev/sdb

At the fdisk prompt: np → Enter → Enter → Enter → t8ew. The 8e type sets "Linux LVM".

3. Create a Physical Volume

sudo pvcreate /dev/sdb1

4. Add it to the Volume Group

sudo vgextend ubuntu-vg /dev/sdb1

5. Extend the Logical Volume and resize

sudo lvextend -l +100%FREE -r /dev/ubuntu-vg/ubuntu-lv

ext4 vs XFS

Filesystem Check Resize command
ext4 df -T shows ext4 resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
XFS df -T shows xfs xfs_growfs / (use mountpoint)
df -T /   # shows filesystem type for the root partition

XFS cannot be shrunk — only grown.


Verify

df -h
sudo lvs

The filesystem size in df -h should now reflect the full allocated space.


Proxmox / VM Workflow

If extending the virtual disk first:

  1. Resize the disk in the Proxmox GUI (or VMware/vSphere)
  2. Rescan inside the VM: echo 1 > /sys/class/block/sda/device/rescan (replace sda with your disk)
  3. Extend the partition with growpart: sudo growpart /dev/sda 3 (partition number varies — check lsblk)
  4. Run sudo pvresize /dev/sda3 to make LVM aware of the larger PV
  5. Then proceed with Scenario A above

growpart

growpart is part of the cloud-guest-utils package: sudo apt install cloud-guest-utils