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.
How we can get around this issue?
All we have to do is increase the storage on the windows VM in the KVM.
In this blog let’s go ahead and extend the storage for windows 10 VM in KVM. Though we are doing it for windows 10 the steps are pretty much the same for other versions of windows as well.
Step1. Locate the Windows 10 disk image.
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
In the same window, you could also see the windows 10 storage size is at 40GB
Step2. 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, 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 copy the image back from the win-backup directory and start the windows.
Step3. Increase the disc size of windows 10 in KVM
- Goto the image location
- 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.
[[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.
Step4. Increase the harddisk size of windows 10 in the disk manager.
Once the size of the VM disk image of windows 10 is done in the KVM, it’s pretty easy to expand the storage under windows, we are basically going to use windows Disk manager utility for this purpose.
- start the windows machine and click on the Start menu and type ‘This PC’
- And right-click on This PC and click on manage
- 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.
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.
- Click on Next on the Extend Volume Wizard
- I am going to add the whole 60GB to C drive, hence leave the default value and click on Next.
- Click Finish on the Extend Volume wizard.
You have now expanded the C drive from 40gig to 100gig.
Step5. Windows Storage Verification in KVM
You can see the whole partition as C drive in windows disk manager.
You can also verify the same from the file explorer as well.
Even on the KVM properties shows that the storage has been extended.