Extend LVM after VM Disk resize
To extend LVM in a Linux VM after a disk resize in Proxmox, resize the partition, expand the Physical Volume (
), and extend the Logical Volume (
). The core commands to run inside the VM are
growpart /dev/sda 2 (adjust device), pvresize /dev/sda2, and lvresize -l +100%FREE /dev/mapper/vg-lv.
Steps to Extend LVM After Proxmox Disk Resize
bash
echo 1 > /sys/class/block/sda/device/rescan
# Replace sda with your disk identifier found via lsblk
Expand Partition (If needed): Use growpart to expand the partition containing the LVM PV. For example, if LVM is on /dev/sda2:
bash
growpart /dev/sda 2
If growpart is not installed, use apt install cloud-utils-growpart or yum install cloud-utils-growpart.
Resize Physical Volume (PV): Tell LVM the partition is larger:
bash
pvresize /dev/sda2
Extend Logical Volume (LV): Extend the LVM to use all new free space:
bash
lvextend -l +100%FREE /dev/mapper/vgname-lvname
# Use 'lvs' to find your correct volume group/logical volume name
Resize Filesystem: Update the filesystem to use the new space.
resize2fs /dev/mapper/vgname-lvname
For XFS: xfs_growfs /