I’m using kvm for a while at work. Everything works quite fine, but today I needed to grow a disk image. I found some informations, but none are really clear so here the result :
First create a empty image file .. with this command (don’t use dd, qemu-img is really quicker than dd):
qemu-img create -f raw temp.img 10G
Next simply your image file + the temp one, in a biggest one ..
cat foo.img temp.img > bar.img
You will get a new image file which is 10G bigger than the original one .. Now you can boot your OS, and discover (via cfdisk for example), that your system has a additionnal 10G unused space .. So next step:
- Just create a new partition, and mount it in the normal way
- Boot your kvm OS from a ISO file containing Gparted
I tried the second approach, and used a ubuntu install to boot (using virt-manager, this is really easy to do). And resized the partition to my need .. simply reboot and “tada” :)
Enjoy disk ?