Resize Qemu Image

Wed 30 October 2013 by Thejaswi Puthraya

The 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.


Using Ubuntu cloud images in KVM

Mon 16 July 2012 by Thejaswi Puthraya

Cross posted from work blog.

Quite a few of our clients are powered by Amazon EC2 or Rackspace and we use Ubuntu LTS releases for our servers. Canonical provides EC2 AMIs and Openstack images for all their releases. By using these JeOS images on the server as well as on …

read more