Resize Qemu Image
Wed 30 October 2013 by Thejaswi PuthrayaThe default cloud image on Ubuntu has a root partition size of 2GB. I wanted a way to resize the root without going through the hassle of setting up LVM.
To be able to resize the qemu images, we need the Guestfish package.
qemu-img create -f qcow2 -b base_disk.img tmp.img
truncate -r tmp.img resized.img
truncate -s 10250M resized.img
virt-resize --resize /dev/vda1=10G tmp.img resized.img
First create a new image (tmp.img) with the base image (use the Ubuntu cloud image) and use that as a base reference for the resized image. Then set the size of the resized (in this case 10G ~ 10205M) image you want to create. After that use the virt-resize tool available in the Guestfish package to resize the disk. Finally, use the resized image in a VM of your choice.