Increase disk size for Windows virtual machine
I need to increase the disk size for a Wiindows 10 virtual machine running on RHEL 7.
I have a volume with 1000 Gb space I set aside for virtual guests.
/dev/sda5 1024522480 190770428 833752052 19% /virt1
On this volume, I have installed 4 virtual machines
ll /virt1
-rw-------. 1 root root 107390828544 Aug 29 07:20 vm1.img
-rw-r--r-- 1 qemu qemu 105530851328 Feb 21 11:26 win10x64-sda
-rw-r--r-- 1 qemu qemu 31798001664 Aug 29 07:16 win70-sda
-rw-r--r-- 1 root root 37760466944 Aug 29 07:15 win7a-sda
A lot of space is unused.
How can I increase the disk size for virtual machine win10x64-sda
from 105 Gb to 300 gb?
The man pages for virt-filesystems and virt-resize are not clear to me.
Responses
Hi Alois,
Assuming your virtual disks reside in the directory /var/lib/libvirt/images and the virtual disk is in qcow2 format, execute :
sudo qemu-img resize /var/lib/libvirt/images/<virtual-disk-name>.qcow2 +195G
If the disk resides in another directory and/or it is in format img, adjust the path accordingly, and replace qcow2 with img.
Perform this operation while the VM is being shutdown and increase the file system later from within Windows as usual. :)
Regards,
Christian
Hi Alois,
If you didn't change the storage location, they are in /var/lib/libvirt/images as you showed in your post above.
But when you create a VM and use another location for the disk, then of course it resides there - only you can
know where disks reside - right ? :) From within Windows means that once the VM is running, open the built-in
Disk Management application and extend the file system like it has to be done in Windows (as usual). Doing it
is self-explaining, for IT sysadmins at least. If you're unsure ask a Windows expert, but I'm sure you will get this
done yourself. As a little hint : You say the disks are in /virt1, which means most probably the right disk is there.
In this case the command would be sudo qemu-img resize /virt1/<virtual-disk-name>.qcow2 +195G
.
Regards,
Christian