Using Qemu

From openSUSE

(Redirected from Qemu)


Geeko QEMU is very nice x86 PC emulator available in versions for Windows and Linux.


Contents

Why QEMU?

As standalone application, without kqemu kernel module that provides acceleration, it is not fast as Xen. Speed is about 10% of real CPU that runs emulation - so if you have a 2 GHz CPU expect a 200MHz emulated CPU. With kqemu, that is available as kernel module from openSUSE 10.3 on, emulated speed is roughly 50% of real CPU which is much better.

QEMU strength over Xen, is that it can run guest operating system without any modification.

If the CPU supports virtualization (such as Intel VT or AMD Virtualization), then in openSUSE 11.1 a modified version of QEMU (qemu-kvm in KVM) can be used to take the advantage of hardware virtualization

Installation

1) Create a qemu virtual-machine directory:

mkdir ~/qemuvm 

This is not a requirement, but it is very helpful once you get several dozens of disk images.

2) install qemu using YaST:

yast -i qemu

Note: The openSUSE 10.3 provides qemu-0.9.0.cvs-14, other SUSE version can have different versions.

Creating hard disk images

Hard disk image is virtual hard disk used by QEMU.

Using qemu-img

3) create a qemu hard disk image in qcow format using:

qemu-img create -f qcow myharddisk.qcow 6G

For details of command syntax see:

info qemu

or type in Konqeror Location field:

info:qemu

that will offer you html version of info pages.

Using dd

Image can be created very fast with the good-old dd command:

dd if=/dev/zero of=myharddisk.img bs=1024 count=0 seek=$[1024*1024*6]

this will do the trick instantly - but it is not compressed, therefore, if you create a lot of operating system images, it will eat your hard disk very quickly.

Running QEMU

Note: if your computer supports hardware virtualization and KVM is installed, then you may try to replace the command qemu with qemu-kvm

4) time to start qemu itself: (instead of typing this, it better to make a shell-script)

qemu -m 256 -hda myharddisk.qcow -cdrom suse-10-dvd.iso -boot d -localtime

-or-

qemu -m 256 -hda myharddisk.qcow -cdrom /dev/cdrom -boot d -localtime

After OS installation, to run installed - just change the "-boot d" to "-boot c", so it will boot using hard disk image.

~/qemuvm> qemu -m 256 -hda myharddisk.qcow -cdrom /dev/cdrom -boot d -localtime

NOTE 1: if you used dd command above then change your script to handle .img format instead of qcow.

NOTE 2: if you use tablet (such as Wacom Graphire), add the command option "-usbdevice tablet".

NOTE 3: The command option "-soundhw es1370" might let the sound card work for Windows XP guest OS.

Comment

Generally it is not recommend to use qemu without kqemu acceleration for emulation of "heavy" guest OSes such as SUSE 10.0 or Windows XP, but for emulation of Windows 95 or 98 it will do just fine.


See also

Passed QA check: --Shayon 18:39, 21 October 2009 (UTC)