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

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

lsblk                        # overview of disks and partitions
sudo pvs                     # physical volumes and their sizes
sudo vgs                     # volume groups and free space
sudo lvs                     # logical volumes
df -h                        # filesystem usage

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