Skip to main content

Resize Proxmox KVM Guest Virtual Disk Partition

virtualization sysadmin
Table of Contents

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.

  1. 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 the template/iso subdirectory.
wget https://downloads.sourceforge.net/gparted/gparted-live-1.5.0-6-amd64.iso
  1. In Proxmox GUI, go to the VM’s Hardware tab. Select the Add button, then CD/DVD Drive. Select the .iso image you downloaded in step 1. The image is now added to the drives.

  2. Select Options | Boot Order. Reorder using drag and drop. Make the iso device (ide0 in my case) the first one listed.

  3. Boot the VM. Accept each setting until Gparted loads. Then extend the drive the usual way.

  4. Shutdown the VM. Undo the Boot Order from step 3 so that the old partition (scsi0) is again the first one booted.

  5. Start the VM and check with a tool (e.g. df) to confirm that the partition reports the new expanded size.

Related

Ansible Cmdb Host Data Collection
utilities sysadmin
ansible-cmdb makes it simple to collect summary data about all the machines on your home network.
Ansible Installation For Daily Debian Package Updates
utilities system configuration sysadmin
Install # Performed on Debian 12 (bookworm)
Beyond Passwords: 5 Ways To Prevent Unauthorized Logins
security ssh sysadmin
Hard-to-guess passwords are important to securing your network from intrusion.