Solved

Increase hard disk size of QEmu/KVM image

Posted on 2010-09-12
6
2,883 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 10

Author Comment

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

Author Comment

by:mstrelan
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

#Citrix #XenApp #Citrix Scout #Citrix Insight Services #Microsoft VMMAP #Microsoft ADEXPLORE #Microsoft RAMMAP #Microsoft TCPVIEW #Microsoft AUTORUNS #Microsoft PROCESS EXPLORER #Microsoft PROCESS MONITOR
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 how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now