Extend Drive and Partition on Proxmox and Linux

Note to Self about Resizing Disk on Proxmox VM and then extending the Partition.

Also reference here : https://pve.proxmox.com/wiki/Resize_disks

Resize VM disk on Proxmox

Example
qm resize 101 virtio-iscsi +100G

log into the Linux VM

fdisk -l /dev/sda | grep ^/dev

can use cfdisk to check size of partitions
cfdisk

Extend the partition in Linux
root@36826:~# growpart /dev/sda 2
CHANGED: partition=2 start=1501182 old: size=837357570 end=838858752 new: size=1047074785,end=1048575967
root@36826:~# growpart /dev/sda 5
CHANGED: partition=5 start=1501184 old: size=837357568 end=838858752 new: size=1047074783,end=1048575967

resize the physical Volume

root@36826:~# pvresize /dev/sda5
Physical volume “/dev/sda5” changed
1 physical volume(s) resized / 0 physical volume(s) not resized

Display Logical Volumes

root@36826:~# lvdisplay
— Logical volume —
LV Path /dev/name-vg/root
LV Name root
VG Name name-vg
LV UUID U4UNl3-
LV Write Access read/write
LV Creation host, time name, 2020-09-12 18:40:46 +0200
LV Status available
# open 1
LV Size 398.30 GiB
Current LE 101966
Segments 1
Allocation inherit
Read ahead sectors auto

  • currently set to 256
    Block device 252:0

Extend Logical Volume

root@36826:~# lvextend -l +100%FREE /dev/name-vg/root
Size of logical volume name-vg/root changed from 398.30 GiB (101966 extents) to 498.33 GiB (127572 extents).
Logical volume root successfully resized.

Resize File System

root@36826:~# resize2fs /dev/name-vg/root
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/name-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 25, new_desc_blocks = 32
The filesystem on /dev/name-vg/root is now 130633728 (4k) blocks long.

Done!