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
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”)
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
Step 5: Open a
Command Prompt as an administrator
Step 6: Run the below commands
diskpartand press Enter
- We have only one virtual disk attached to the VM
select disk 0
list partition(Note the number of the Recovery partition)
select partition 3
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
Click Next on Extend Volume wizard until
Finish to see your partition size expanded to 49.45GB as below: