Skip to Content

Fix – How To Extend Windows Guest VM Storage in KVM ?

Fix – How To Extend Windows Guest VM Storage in  KVM ?

I have one windows machine that I use as an alternate operating system in my Linux KVM. Recently I noticed that the C drive in my windows got filled up and there is not enough space left to store any more data.

If you have a physical box then it is a little difficult, as you have to expand your physical hard disk storage. Since we are using windows as a VM, then we are in luck and it is way too easier.

So how do I get around this issue ?

kvm increase windows disk size

Well, all we have to do is increase the KVM qemu disk size. Once the VM disk space has increased on the KVM side, you will have to expand the hard drive in windows. You can either extend the existing C drive or create a new drive from the unallocated drive.

If you see the extend option is grade out in the C drive, then follow the article here to fix that.

The steps mentioned here are identical to all the versions of Windows, be it windows client such as Windows 10/11, or windows servers.

How do I increase the size of a qemu image?

In this Windows KVM disk partitioning guide let’s go ahead and extend the storage for windows 10 VM guests in KVM. Though we are doing it for windows 10 the steps are pretty much the same for other versions of windows as well, such as windows 7, 11, server, and so on.

Step 1. Locate the Windows 10 qemu disk image.

We are going to increase the VM’s virtual hard disk storage using KVM resize disk, before you perform that, first you need to find the KVM disk image.

You can find the KVM qemu disk image either using GUI or the CLI.

Using GUI

Shut down the windows machine in KVM and locate the Windows 10 disk image.
In Virt manager click on properties of the windows 10 VM and click on VirtIO Disk 1, Here you can see the storage location of windows 10

Virt-manager increase disk size for windows vm

In the same window, you could also see the windows 10 storage size is at 40GB

Using CLI

You may type the command virsh domblklist win10, you should be able to see the virtual harddisk storage here.

aif@gns3vm:~$ virsh domblklist win10
 Target   Source
-----------------------------------------------
 vda      /var/lib/libvirt/images/win10.qcow2
 sdb      -
saif@gns3vm:~$ 

Now goto the image location and type ls -l

saif@getlabsdone:$ cd /var/lib/libvirt/images/
saif@getlabsdone:/var/lib/libvirt/images$ sudo ls -l -h
total 40G
-rw------- 1 libvirt-qemu kvm 40G Aug 30 12:31 win10.qcow2
saif@getlabsdone:/var/lib/libvirt/images$ 

Step 2. Backup the storage.

Before we make changes it is better to have a backup, just in case if anything goes wrong.

To take a backup, you can copy the same disk image to a new folder. I am creating a new folder called win-backup.

[root@getlabsdone images]# mkdir win-backup
  • Copy the win10 image to the new directory.
[root@getlabsdone images]# cp win10.qcow2 win-backup/
  • Verify disk image has copied.
[root@getlabsdone images]# ls -l win-backup/ -h
total 40G
-rw-------. 1 root root 42G Jan 16 21:40 win10.qcow2
[root@getlabsdone images]#

once you have the backup ready you can go ahead with the next steps.

Note: in case of any issue you can remove the existing image and edit the windows XML file with the command virsh edit win10 and replace the image with the backup image and start the windows.

Step 3. KVM Qemu increase windows disk size.

To increase the KVM disk size qcow2 for windows, follow the below.

  • Goto the image location /var/lib/libvirt/images
cd /var/lib/libvirt/images
  • I had given 40GB of storage during the VM installation, now I am going to expand to 60GB, to do that enter the command below.
    So 40GB+60GB=100GB in total.
[root@getlabsdone images]# qemu-img resize win10.qcow2 +60G
Image resized.
[root@getlabsdone images]#

Once you enter the command you could see that the image size got increased.

Merge unallocated space to C drive?

Once the size of the VM disk image of windows 10 is done in the KVM above, it’s pretty easy to expand the storage under windows, we are basically going to use the Windows Disk manager utility for this purpose.

1. Find the unallocated space.

  • start the windows machine and click on the Start menu and type ‘This PC’
  • And right-click on This PC and click on manage
windows kvm disk partitioning resize using disk manager
  • The windows computer management window now open, click on Disk management.
  • As you can see the increased storage is added as Unallocated storage in windows disk management.
windows kvm disk partitioning on windows 10

2. Extend the Volume.

You can either extend the drive or add a new drive. If you are planning to create a new drive then you can right-click on the Unallocated space and create a new simple volume. I am going to extend the drive.

  • To extend the drive right-click on the ‘C drive’ and click on Extend Volume.
windows kvm disk partitioning expand
  • Click on Next on the Extend Volume Wizard
extend windows volume in kvm
  • I am going to add the whole 60GB to C drive, hence leave the default value and click on Next.
windows kvm disk partitioning
  • Click Finish on the Extend Volume wizard.
kvm windows disk partition resize

You have now expanded the C drive from 40gig to 100gig.

3. Windows Storage Verification in KVM.

You can see the whole partition as C drive in windows disk manager.

kvm windows disk partition increase

You can also verify the same from the file explorer as well.

kvm windows disk partition hard drive

Even the KVM properties show that the storage has been extended.

extending the storage on windows 10 in KVM

You should be good to go, but what if your extend option is grayed out, you can create another drive in windows by following the steps below, or you can follow the article here to fix that and still extend the C drive.

How to add unallocated space to drive?

If you decided not to extend the C drive rather create another drive with unallocated space then you can follow the steps below.

  1. Right-click on the unallocated space and click on New Simple Volume..

In the new simple volume screen, leave the default value to select the whole disk or choose your Value, then click on Next.

Select the drive letter and click on Next.

It will now prompt you for the file system and the format option, I am choosing the default value and then click on OK.

You would get a summary of the changes you will perform on your machine, validate them, and then click on Finish.

That’s it. You just got a new hard disk drive created as D drive.

How to add unallocated space to D drive

Confirm the same by going to the windows explorer, as you can see the new D drive added.

How to add unallocated space to D drive