Friday, March 16, 2012

QEmu

QEMU

This document details the creation and operation of virtual images using Qemu .


CREATING VIRTUAL HARD DISK
To create a virtual disk from Qemu to act as the hard disk for the virtual system give the following command

qemu-img create -f qcow minix.img 2G

here �f stands for the format which in this case in qcow which is a Qemu format other formats are also available.
fmt
is the disk image format. It is guessed automatically in most cases. The following formats are supported:
raw
Raw disk image format (default). This format has the advantage of being simple and easily exportable to all other emulators. If your file system supports holes (for example in ext2 or ext3 on Linux or NTFS on Windows), then only the written sectors will reserve space. Use qemu-img info to know the real size used by the image or ls -ls on Unix/Linux.
qcow2
QEMU image format, the most versatile format. Use it to have smaller images (useful if your filesystem does not supports holes, for example on Windows), optional AES encryption, zlib based compression and support of multiple VM snapshots.
qcow
Old QEMU image format. Left for compatibility.
cow
User Mode Linux Copy On Write image format. Used to be the only growable image format in QEMU. It is supported only for compatibility with previous versions. It does not work on win32.
vmdk
VMware 3 and 4 compatible image format.
cloop
Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix CD-ROMs.

INSTALLATION
For installation using iso image on your hard disk it is preferred that you place them where qemu is so thet you don�t have any path issues.

The following command
qemu -L . -hda solaris.img -cdrom sol-10-u3-ga-x86-v1.iso -boot d -m 256

starts the installation on the virtaul hard isk by the name solaris.img the �L option followed by a .(dot) specifies that the boot images ( such as PC Boot) are in the same directory.

-cdrom tells Qemu to use the iso as a cdrom.

Boot d is used for installation mode to tell it to boot from cdrom

-m 256 specifies how much memory should be allocated for this virtual machine.


RUNNING THE VIRTUAL MACHINE


Run the following command to test your virtual machine.


qemu -hda solaris.img -m 256 -boot c


ISSUES AND RESOLUTION

Regarding multiple iso�s.
To change a floppy and a CD-ROM image, please use QEMU Monitor. To see the Monitor, press Ctrl-Alt-2 keys together. To go back to the guest OS, press Ctrl-Alt-1 keys.
Please use slash instead of back slash in a QEMU Monitor.
For floppy,
(qemu) change fda filename.img
or
(qemu) change fda d:/tmp/yourfile.img

For CD-ROM,
(qemu) eject cdrom
(qemu) change cdrom filename.iso
or
(qemu) eject cdrom
(qemu) change cdrom d:/tmp/yourcdrom.iso
You can see a status of block device.
(qemu) info block

For physical cdrom give the cdrom drive letter

Ctrl+alt+2
eject -f cdrom
change cdrom /dev/cdrom
(or change cdrom \\.\E: )

No comments: