Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Resizing kvm qcow2 disk

Digital Innovation Partner

Resizing kvm qcow2 disk

I followed this steps in order to add some space to a virtual disk in kvm environment

convert qcow2 disk to be expandend in raw format:

 qemu-img convert -f qcow2 to-be-expandend.img -O raw to-be-expandend.raw 

create extra space, 30G in this case:

sudo qemu-img create -f raw addon.raw 30G

merge the two files:

cat  to-be-expandend.raw addon.raw >expanded.raw

re-convert in qcow2 format:

qemu-img convert -f raw expanded.raw -O qcow2 expanded.img

To be used, the extra space needs to be re-partitioned in the guest OS.
To do that, download the Gparted live cd

Then add the cdrom to the guest OS pointing to the downloaded iso. You can do that via the virt-manager or adding an xml like the following in the VM configuration file:

    
      
      
      
    

Add also the cd boot option:

  
    hvm
    
  

Resize the partition, disable the cdrom boot and restart the VM

Extra space available!

Una risposta.

  1. […] post about qemu image resize: https://synaptica.info/2012/02/20/resizing-kvm-qcow2-disk/ where you can find some info about image format conversion […]

Lascia un commento