Development notes

Thoughts, notes and ideas about development

Expanding VM Disk in Proxmox with LVM

2026-02-19 2 min read DevOps

LVM (Logical Volume Manager) is a disk management system in Linux that adds a flexible abstraction layer between physical disks and filesystems. This guide covers how to expand a VM disk in Proxmox when using LVM inside the guest.

LVM Overview

LVM Structure (bottom to top)

Three LVM Layers

  1. Physical Volume (PV) — physical volume (disk partition)
  2. Volume Group (VG) — volume group (pool of PVs)
  3. Logical Volume (LV) — logical volume (virtual disk)

Disk Expansion Process

Step 1: Resize Disk in Proxmox

Option A: Via Web UI

  1. Select your VM in the list.
  2. Go to Hardware tab.
  3. Click on Hard Disk (scsi0).
  4. Click Disk ActionResize.
  5. Enter the amount to add, e.g., +20 (adds 20GB).
  6. Click Resize disk.

Option B: Via CLI on Proxmox Host

qm resize <vmid> scsi0 +20G

Step 2: Expand Partition and LVM Inside VM

# 1. Install growpart tool if not present
sudo apt-get update
sudo apt-get install -y cloud-guest-utils

# 2. Grow partition 3 to use all available space on sda
sudo growpart /dev/sda 3

# 3. Verify the partition is now larger
lsblk

# 4. Resize the physical volume to use the new partition space
sudo pvresize /dev/sda3

# 5. Check available space in volume group
sudo vgs

# 6. Extend the logical volume to use all free space
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

# 7. Resize the ext4 filesystem
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

# 8. Verify the result
df -h
lsblk

Alternative Options for Step 6

# Add a specific amount
sudo lvextend -L +10G /dev/mapper/ubuntu--vg-ubuntu--lv

# Extend to a specific size
sudo lvextend -L 45G /dev/mapper/ubuntu--vg-ubuntu--lv

For XFS Instead of ext4 (Step 7)

sudo xfs_growfs /

Checking for LVM

# Check if LVM is in use
df -h | grep mapper
lsblk -f

# Physical Volume information
sudo pvs
sudo pvdisplay

# Volume Group information
sudo vgs
sudo vgdisplay

# Logical Volume information
sudo lvs
sudo lvdisplay

Important Notes

  • All operations are safe and can be performed on a running VM
  • No data loss
  • No reboot required
  • After lvextend, resize2fs is mandatory, otherwise OS won’t see the new space
  • For XFS, use xfs_growfs instead of resize2fs

References

comments powered by Disqus