How To Extend Windows 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 I will show you how you can get around that as well.

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, 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

Shutdown 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

kvm extend hdd boot windows 10

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.

[email protected]:~$ virsh domblklist win10
 Target   Source
-----------------------------------------------
 vda      /var/lib/libvirt/images/win10.qcow2
 sdb      -

[email protected]:~$ 

Now goto the image location and type ls -l

[email protected]:$ cd /var/lib/libvirt/images/
[email protected]:/var/lib/libvirt/images$ sudo ls -l -h
total 40G
-rw------- 1 libvirt-qemu kvm 40G Aug 30 12:31 win10.qcow2
[email protected]:/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.

[[email protected] images]# mkdir win-backup
  • Copy the win10 image to the new directory.
[[email protected] images]# cp win10.qcow2 win-backup/
  • Verify disk image has copied.
[[email protected] images]# ls -l win-backup/ -h
total 40G
-rw-------. 1 root root 42G Jan 16 21:40 win10.qcow2
[[email protected] 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.
[[email protected] images]# qemu-img resize win10.qcow2 +60G
Image resized.
[[email protected] images]#

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

How do I 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 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.
windows kvm disk partitioning on windows 10
  • As you can see the increased storage is added as Unallocated storage in windows disk management.

Step 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 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 on the KVM properties shows 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 grade out, lets look at that now.

How do I merge unallocated space to C drive extend volume greyed out?

The reason you are seeing the extend option grade out because there is a recovery partition between the C drive and the unallocated space.

As you can see below, I don’t have the Extend volume enabled on my disk manager.

can't extend c drive with unallocated space windows 10

Even if you try to delete the partition in the middle, the windows default disk manager will not let you. It would just show you a help option.

Can I delete the recovery partition Windows 10?

What does the recovery partition do?

The Windows operating system creates the extra Recovery Partition during the windows installation. That holds the windows recovery environment. So in the event of any windows system-related issues, and you wanted to restore the windows machine to its original state, you can use the recovery option.

Is it safe to delete recovery partition in Windows 10?

For an average user, I don’t recommend deleting the recovery partition on your windows machine. Otherwise, you will have to carry around the windows bootable image either on a CD or USB any time you want to do the restore option. But for VM’s, we already have a backup in place, so we are good.

How do you extend the windows KVM hard disk?

You got two choices, either

Move the recovery partition to another disk and extend c drive.

or

Create another drive from the unallocated space.

How to move the recovery partition to another disk and extend C drive?

You decided to extend the C drive because it was fully utilized, right?

And so it doesn’t make sense to create a separate Drive, so how do we still go ahead and extend the C drive when there is a recovery partition in the middle and the extend volume is grade out?

So let’s go ahead and take a look.

You cannot delete, modify, or move the recovery drive with the default windows device manager.

So we will use a software called EaseUS partition manager Opens in a new tab.for this purpose. As the name suggests, it is effortless to use, and you can get your partition expanded in a couple of seconds.

This partition manager will help you move that extra partition (recovery partition) and extend the C drive as well.

I am using a different VM now, where I have given only 20GB of virtual hard disk during the installation. Now I am struggling as I don’t have enough storage.

windows extend hard drive disappeared

You can see my C drive is almost full, and I already extended the windows KVM image following step 3 above. And I have given an extra 20GB.

qemu-img resize win10.qcow2 +20G

Let’s see how we can extend the partition when there are other partitions in between.

  1. Download and install the partition manager.
  2. Open the partition manager.
  3. Move the recovery partition to another drive.
  4. Expand the C drive.
  5. Execute the operations.
  6. Verify the changes.

1. Download and install the partition manager.

Click hereOpens in a new tab. to download the easeus partition manager.

Note: Though the trial version will help you save the operation, you need to have a license to execute the operations.

2. Open the partition manager.

Once you have the software downloaded and installed, you may go ahead and open it.

You should be able to see the list of partitions in your windows machine.

3. Move the recovery partition to another drive.

We will now move the recovery partition, which sits in between the C drive and the unallocated space, to the end of the hard disk.

Select the recovery partition, which is around 500MB, and click on Resize/Move. The third one in my case.

windows 10 extend c drive recovery partition

Move the recovery partition to all the way to the right.

windows 10 extend c drive recovery partition

You can see the unallocated size of 20GB moved to the left, as in when we moved the recovery partition to the right. Click on OK here.

How do I move the healthy recovery partition?

You should now see the recovery partition moved from the third to the fourth, which is good.

And the task has now been added to the operation.

Recovery partition blocking Extend Volume

4. Expand the C drive.

After the recovery partition has been moved, let’s go ahead and extend the C drive.

Click on the C drive. As you can see, the size is almost full.

On the right, you should be able to see an option which says Resize/Move. Click on that.

extend c drive recovery partition

You will get another prompt, which will help you to extend the hard disk easily.

On the expand the screen, resize the C drive to the size that you prefer.

Just drag the dot to the right; it depends on how much space you need, then clicks on OK.

can extend c drive recovery partition

I prefer to use the whole 20 GB of unallocated space for my C drive, so I selected the entire disk and clicked on OK.

add unallocated partition to c drive

As soon as you clicked on OK, you can see the C drive is expanded in the software, and this task has also gone to the operations queue.

And you should be able to see two operations in the queue first for moving the recovery partition to the end, and the second is for expanding the C drive.

5. Execute the operations.

Both the operations are not completed yet; we are going to do that now. To do that, click on Execute 2 operations option.

Recovery partition blocking Extend Volume

A new window will pop up, which shows you the changes you will make. Click on Apply.

As soon as you click on Apply, it should start its work in the backend.

Recovery partition blocking Extend Volume

Alright, both the operations are now completed. Click on Finish.

Move recovery partition to another drive

6. Verify the changes.

We have successfully moved the recovery partition to the end of the harddisk now and also expanded the C drive to 40GB as well, which we weren’t able to do it using windows disk manager before.

To confirm the changes, open your windows file manager, and you can see the C drive is expanded successfully.

unallocated partition to c drive

You can also see the recovery partition under the disk manager as well.

move recovery partition to end of disk

Though you don’t need to reboot the machine after the change, it is recommended to reboot the windows host as well, so please go ahead and reboot the machine and continue to use the system with more storage 😊

How do I add unallocated drive in Windows 10?

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

Saifudheen Sidheeq

Saifudheen is in the Computer networking and technology field for about a decade now. He loves technology and new ideas, and in his spare time, he loves to write about them.

Recent Posts