Increase Disk Space of VM
Sometimes it's necessary to increase the disk space of a VM. Here is how to do it:
- In Proxmox, go to the VM, enter the "Hardware" tab and resize the disk.
Now, we do the rest on the VM. Enter it and install parted
Find out the disk and partition you would like to extend. Let's say, it's /dev/sda5 which is an logical partition on the extended partition /dev/sda2.
Increase both sda2 and sda5 to the maximum amount: parted -s /dev/sda resizepart 2 '100%' and parted -s /dev/sda resizepart 5 '100%'
If LVM is used, find out the PV's and VG's name (pvs and vgs), in this example /dev/sda5 and volgroup.
Make the PV use all the space on the partition: pvresize /dev/sda5
Now vgs (or vgdisplay more verbosely) should show free space
Then you can increase the size of the LVs, e.g.: lvextend -l +95%FREE /dev/mapper/volgroup-root or lvextend -L +10G /dev/volgroup/var (both paths work)
The filesystem also has to be increased: resize2fs -p /dev/volgroup/root
Check whether it worked with df -H. In rare cases, you may have to run partprobe or reboot.