Solved

Increase hard disk size of QEmu/KVM image

Posted on 2010-09-12
6
2,900 Views
Last Modified: 2012-05-10
Hi experts,

I have Ubuntu 10.04 Server (no gui) install with the default KVM server stuff that came on the install disk. I have created a virtual Ubuntu server with vmbuilder with a 4gb qcow2 image. I am wondering now how I can resize this virtual drive to 16gb.

Have tried a few things but none of them are working, Any ideas?
0
Comment
Question by:mstrelan
  • 4
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
Jelcin earned 500 total points
ID: 33660237
1. Convert the qcow image to raw format. (qemu-img convert yourqcow2image -O raw yourrawimage)
2. Extend the raw format image using dd (see my example below)
3. Convert the raw image back to qcow format (qemu-img convert yourrawimage -O qcow2 yourqcow2image)
4. Boot up qemu with the new qcow2 image under for example gparted live cd and resize the partition.
6. Reboot qemu with the resized qcow2 image and the Linux on it.

dd if=/dev/zero of=hdd.img seek=N obs=1MB count=0
N is new size to resize hdd.img in MB

And don't forget to backup your qcow2 image before you start!!!
0
 
LVL 10

Author Comment

by:mstrelan
ID: 33660846
Thanks Jelcin, I was hoping this would be the answer as this is what I have been trying, but now hopefully you can help me with it.

How do I boot up qemu with the gparted live cd? Also can I use gparted over ssh or do I need physical access to the server?
0
 
LVL 6

Expert Comment

by:Jelcin
ID: 33660911
sudo qemu -daemonize -boot d -m 512 -hda /home/user/qemu/debian_stable.img -cdrom /home/user/qemu/gparted-live-0.6.2-8.iso -net nic,vlan=0, macaddr=52:54:00:12:34:56 -net tap, vlan=0, ifname=tap0

That's how i start my qemu VM. For you it is important to give qemu "-boot d" for CD-ROM (c would be hdd) and "-cdrom /path/to/gparted" for the path to CD-ROM image.


0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 10

Author Comment

by:mstrelan
ID: 33661284
Thanks, I will give it a go in the next 10-18 hours and report back.
0
 
LVL 10

Author Comment

by:mstrelan
ID: 33667652
When I try to start using qemu I get "Could not initialize SDL - exiting". From what I have read this is because I'm accessing the server via SSH, rather than a Windowed environment such as Gnome or KDE.

Do I need to install Gnome and then physically access the server to achieve this or can I partition the drive without a GUI? I read that I can simply run e2fsck followed by resize2fs, but I can't do this because the drive is already mounted when I access it over ssh.
0
 
LVL 10

Author Comment

by:mstrelan
ID: 33669300
Oh I finally got it! I needed to install a vnc server, then add -vnc :1 to the command above. Then I can access it via vnc on my desktop!
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question