Resizing a KVM disk image
I use KVM daily for testing purposes of Ubuntu One on Windows. Recetly I created a Vista VM with 20Gb thinking that it was going to be big enough, turns out that after installation I had a single Gb left (WTF!). Not wanting to have to go through the painful installation process again I decided to find out how to re-size a KVM disk image. Here are the steps if you have to do the same:
Create a new image with the extra size
sudo qemu-img create -f raw addon.raw 30G
Add the new data, my old vm image is called caranage_old.img. Do remember the order is important, otherwise the image won’t boot.
cat carnage_old.img addon.raw >> carnage.img
- Create a new vm that uses the new image and resize the hardrive accordingly. For example, on Windows Vista I had to go to Mamangement Tools and resize the C: partition to use the new 30Gb.
I hope it helps!