Post

Proxmox - Resize VM Disk

Shutdown the VM

1
2
3
4
5
6
Go to VM
Go to Hardware
Click Hard Disk you want to resize
Click 'Disk Action' then 'Resize'
Enter the amount to increase in GB's
Start VM

SSH in to the VM

Drop to Sudo

1
sudo su

Check for Free Space

1
cfdisk

You should see the space that you added when modifying the hardware tab as free.

Find the disk that holds the lvm:

1
2
3
4
5
6
7
8
root@ubuntu:/home/binky# lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                         8:0    0   64G  0 disk 
├─sda1                      8:1    0    1M  0 part 
├─sda2                      8:2    0    2G  0 part /boot
└─sda3                      8:3    0   30G  0 part 
  └─ubuntu--vg-ubuntu--lv 252:0    0   15G  0 lvm  /
sr0                        11:0    1 1024M  0 rom  

Here it shows as sda3 (yours may differ)

Resize with cfdisk

1
cfdisk

cfdisk

Select your /dev/sda3 partition

1
2
3
4
Select RESIZE and hit ENTER
New size will be entire free space by default, hit ENTER
Click WRITE, then type 'yes', press ENTER
Press 'q' or select 'Quit'

Then you need to extend the partition

1
2
3
4
5
pvresize /dev/sda3

root@docker-int:/home/sysadmin# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Check Volume Group for Free Space

1
vgdisplay

Extend the volume

1
2
3
4
5
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

root@docker-int:/home/sysadmin# lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <15.00 GiB (3839 extents) to <62.00 GiB (15871 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

Confirm Changes

1
lvdisplay

Resize Root File System

1
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

Confirm Changes

1
df -h
This post is licensed under CC BY 4.0 by the author.