Problem #
Resizing a KVM linux guest virtual disk involves two steps: (1) resizing the disk on the host system; followed by (2) extending the partition on the guest to use all of the newly allocated space. The Proxmox GUI lets you easily do step #1. However, booting into the VM to perform #2 won’t work. Running resize2fs
reports that there is nothing to do. Similarly, fdisk
tells me I’m already using all of the capacity.
Solution #
The disk can’t be resized while booted into it (mine’s mounted as root (/) on /dev/sda1, msdos partitioning). Instead, you must boot from another partition or virtual drive with the image you want to resize also attached. I chose gparted
.
- Download gparted iso image to one of the storage locations. You can use the GUI (
Download from URL
) button or the command line to put it in thetemplate/iso
subdirectory.
wget https://downloads.sourceforge.net/gparted/gparted-live-1.5.0-6-amd64.iso
-
In Proxmox GUI, go to the VM’s Hardware tab. Select the
Add
button, thenCD/DVD Drive
. Select the .iso image you downloaded in step 1. The image is now added to the drives. -
Select
Options
|Boot Order
. Reorder using drag and drop. Make the iso device (ide0
in my case) the first one listed. -
Boot the VM. Accept each setting until Gparted loads. Then extend the drive the usual way.
-
Shutdown the VM. Undo the Boot Order from step 3 so that the old partition (
scsi0
) is again the first one booted. -
Start the VM and check with a tool (e.g.
df
) to confirm that the partition reports the new expanded size.