Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a windows 7 virtual machine on Centos 6 running the following:

virt-install --name=W7VIRT64 --ram=768 --disk path=/var/lib/libvirt/images/guest1-win7-32,size=8 --vnc --network network=default --os-type=windows --os-variant=win7 --cdrom=/root/win7.iso

I was able to successfully install the guest OS and get it to boot.

How do I go about increasing the disk image size to 20G using non-gui tools?

share|improve this question

First locate to your image directory. Then make sure your image is raw type. You can check it using

qemu-img info your_image

. If it is not raw type you can use

qemu-img convert

to convert it to raw type. Then:

dd if=/dev/zero of=temp bs=1G count=0 seek=20 #create temporary file of 20GB

cat temp >> your_image #append the temporary file to the end of your image

Next you may use gparted or partition magic to resize your partion. And last but not least just reboot you windows and let check disk utility to do its part. Good luck...C:

share|improve this answer

From the qemu-img man page

qemu-img resize filename [+ | -]size
           Change the disk image as if it had been created with size.

           Before using this command to shrink a disk image, you MUST use file
           system and partitioning tools inside the VM to reduce allocated
           file systems and partition sizes accordingly.  Failure to do so
           will result in data loss!

           After using this command to grow a disk image, you must use file
           system and partitioning tools inside the VM to actually begin using
           the new space on the device.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.