Monday, May 21, 2007

qemu


Create a virtual HDD:

#qemu-img create hda.img 5G


Set 512MB of virtual memory, allow access to a virtual HDD and boot from a virtual CD using an ISO file:

#qemu -m 512 -hda hda.img -cdrom ubuntu-7.04-desktop-i386.iso -boot d

-boot a, c, d = floppy drive, hard drive, optical drive respectively
-no-kqemu = if kqemu kernel module not present


Boot from a virtual HDD:

#qemu -m 512 -hda hda.img


Convert a "RAW" HDD image to a "QCOW" compressed image:

#qemu-img convert -c hda.img -O qcow harddiskimage.img


Check image type:

#qemu-img info hda.img

image: hda.img
file format: raw
virtual size: 5.0G (5368709120 bytes)
disk size: 2.3G



#qemu-img info harddiskimage.img

image: harddiskimage.img
file format: qcow
virtual size: 5.0G (5368709120 bytes)
disk size: 891M



CTRL+ALT+2 = qemu console

Save virtual memory state:

(qemu) savevm dump.img

Load virtual memory state:

(qemu) loadvm dump.img


CTRL+ALT+1 = qemu main screen

Start qemu using a hard drive image and restore saved memory state:

#qemu -m 512 -hda hda.img -loadvm dump.img

No comments: