This article describe how to increase the size of an existing KVM/QEMU image stored in raw format. The example use virt-manager, windows 7 as guest OS and debian Jessie as host T
Given that we use Windows 7 and that we are going to modify the main partition size, we must defragment the disk using the famous tool provided by windows.
Once the defragmentation is finished you can stop the VM.
The following operations assume that the VM images are stored in /var/lib/libvirt
; it's the default location where virt-manager put his VM.
The first step is to rename the original VM image :
mv win_7.img win_7.backup
Next, you have to create a new blank VM image using the qemu-img
tool:
qemu-img create -f raw plus.raw 10G
Finally, you aggregate the previous files into a newer:
cat win_7.backup plus.raw >> win_7.img
Without to wait the end of the previous operation you can download the gparted live CD in order to prepare the next step.
Gparted live CD is available at http://gparted.org/
Once the file win_7.img
has been created, you can setup your VM in virt-manager in order to spread over his maximum the partition size.
If there is no IDE CDROM item you must add it using the add hardware
button.
The following screen must appear
At startup the live CD will ask you several questions about your country and you keyboard layout. Be aware to answer correctly if you don't wan't to be in trouble later.
resize/move
:Apply
At this step, you have finished to use gparted.
At the first boot, Windows 7 will detect the change of the size partition and then will ask you to check the integrity of your disk. You must answer YES.
Once the check is finished the system should boot normally and you can verify using the explorer that the disk size increased as expected.
That's all!!