Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.