Qemu images can’t be growed. In this exemple I will show you a little hack to grow a 6GiB qcow image to a 10GiB image. Beware: these operations can take a lot of time to perform and require lots of free space.
First, convert your qcow image to a plain raw file:
qemu-img convert system.qcow -O raw system.raw
Then, create a dummy file (filled with zeros) of the size of extra space you want to add to your image. In this case, 4GiB (=10GiB – 6GiB):
dd if=/dev/zero of=zeros.raw bs=1024k count=4096
Fearlessly, add your extra space to your raw system image:
cat system.raw zeros.raw > big10G.raw
After that you can boot qemu to verify that added free space is available:
qemu -hda big10G.raw
Here is an real case exemple of what you can see in a qemu image on which Windows XP was installed:

Now, to grow your primary partition, I suggest you to download a Live CD like gparted Live CD or System Rescue CD, and boot on the .iso file with qemu:
qemu -hda big10G.raw -cdrom gparted-livecd-0.3.4-5.iso -boot d
This will allow you to grow and manipulate all your partitions safely thanks to parted and other open source system tools.
Finally you can convert back your raw image to a qcow one to not waste space:
qemu-img convert big10G.raw -O qcow growed-system.qcow
That’s all !
By the way, I think it’s possible to perform the second and third step of this how-to in a single operation using dd only.
Update: I missed it, but this issue is also described in the FAQ from the unofficial #qemu wiki (look at “How do I resize a disk image?” question).

Thanks for putting this up. I’ve tried this a few times but after I cat my raw files together it no longer boots:
- works fine
- came up to a safe mode prompt the first time, boots normally now.
If I run an image image of
partedmagic-1.6it shows the partition correctly and lets me resize it – but resizing a non bootable image doesn’t mean a whole lot. My guess is the problem has something to do with thevirtual size: 2.0G disk size: 1.0Gof my raw file. That’s what qemu-img gives me converting from cow format. XP shows the drive as being 2GB when I run the original image.I’ve never encounter your problem during my experiments, and I have no idea how to fix your problem. Sorry…
I didn’t know the
qemu-img infocommand. I don’t know if this can help you, but the onlyrawimage file I still have return me this:As you can see, like you, I have the same 1G offset…
If you have the image in a raw file and the host filesystem is supporting files with holes a simpler, quicker and less space-wasting way to increase your virtual disk size is:
In this way
ddleaves a hole of 10G from the beginning of the file (leaving everything untouched) and then writes a 0.For details on “A disk read error has occurred.” please check this post: http://qemu-forum.ipi.fi/viewtopic.php?p=12362
The complete procedure would now be
1- Convert to a raw image
2- Increase the size of the raw image
where
Nis the number of GigaBytes3- Fix the NTFS BPB
Edit the raw file:
hexedit system.rawGoto to offset 7E00:
7E00Change 80 to FF at offset 7E1A and save:
FF --> Ctrl-x --> y4- Boot Windows and check that you see a bigger disk in the admin tools
5- Use (fantastic) gparted to resize your NTFS partition
6- Boot windows to check and perform a chkdsk
7- If you need to save space, convert back to qcow
shouldn’t that be:
Maybe this is why people are having trouble with it?
The reason that
cat system.raw zeros.raw > big10G.rawworks is because you’re cat’ing the contents of both files before redirecting them tobig10G.rawIn THEORY you should be able to do
cat zeros.raw >> system.rawbut don’t quote me on that or blame me if it screws up your image
I tried
and it works!
At least for me, it’s an old linux ext2 image.
I also tried a gparted twist without the liveCD:
it can see it, but cannot resize it
hello!
Great tutorial, but how i do it in windows?
Install a qemu guest with linux and do it
Serious (or not) do not know!
Great tutorial btw, thanks
Hi,
Just to say that I accomplished this on windows by replacing the dd and cat steps – with the windows type command…..
I created the raw image:
then created a copy of that:
then used that to create a 3rd disk:
rawdisk3could then boot normally both using qemu (in which case it was in the same condition asrawdisk1) and using the gparted iso – in which case the extra space could be seen.I manipulated the partitions using gparted and grew the disk.
…as they say in Scotland – nae bother!