Increase virtual disk size of Windows10 VM on QEMU-KVM

Updated on April 13, 2022

Recently I created a windows image using QEMU-KVM and ported it onto OpenStack for one of my clients. While creating the windows image I had set the virtual disk size as 40GB. However, the client requested an additional virtual disk of 10GB. In this article, we shall learn how to increase the virtual disk size of a Windows 10 VM on the QEMU-KVM hypervisor.

How to Increase Virtual Disk Size of Windows 10 VM on QEMU-KVM

Step 1: Open the Virtual Machine Manager and shut down the VM

QEMU-KVM Virt-Manager: Shutdown a VM

 

Step 2: Go to command-line, run the below command from the KVM hypervisor to increase the size of the disk image file itself

# qemu-img resize win10.qcow2 +10G
Image resized.

Step 3: Upon success, start the VM

# virsh start win10-2
Domain win10-2 started

Step 4: Once the VM is booted completely, go to Disk Management (Right-click on Start Menu and then select “Disk Management”)

Open Disk Management on Windows 10

 

Disk Management on Windows 10

Even though you have increased the disk size of your VM, it does not automatically increase the size of your primary partition. The increased size shall be shown as Unallocated as shown in the above image. You need to manually expand the primary partition to include the unallocated space. Earlier, this could have been done easily; however, Windows 10 inserts a recovery partition after the Windows 10 primary partition and this cannot be deleted from Disk Management!

How to delete a Windows Recovery Partition

Assumption:

Assuming that there are no other partitions after the Windows 10 Partition and the Recovery partition being partition 3 with approx 500MB.

Step 5: Open a Command Prompt as an administrator

Search cmd on Windows to run as administrator

Step 6: Run the below commands

  • Typediskpart and press Enter
  • Type list disk
    • We have only one virtual disk attached to the VM
  • Type select disk 0
  • Type list partition (Note the number of the Recovery partition)
  • Type select partition 3
  • Type delete partition override

Expand an active Windows 10 system partition

Once there is no recovery partition between an active system partition and an unallocated partition, we are free to expand the active system partition using Disk Management.

Step 7: Go back to Disk Management, Right-click on the system partition, and click Extend Volume.

Extend Windows Volume in Disk Management

Click Next on Extend Volume wizard until Finish to see your partition size  expanded to 49.45GB as below:

increase virtual disk size Windows 10

Was this article helpful?

Related Articles

Leave a Comment