Solved

Increase hard disk size of QEmu/KVM image

Posted on 2010-09-12
6
2,948 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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.
A look into Log Analysis and Effective Critical Alerting.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

631 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