Qemu is another virtual machine application for Linux and an alternative to Oracle's VirtualBox. With Qemu, users can run a larger variety of virtual machines than VirtualBox. Oracle's VBox supports x86-64 and x86 operating systems as guests while Qemu supports other architectures such as arm, mips, and more. However, many users report difficulties with network support for the guest systems. This article will discuss the basics of using Qemu, but not the networking.
To create virtual hard-drives for the virtual machines, run "qemu-img create /PATH/AND/FILENAME SIZE" where "SIZE" is the desired virtual hard-drive size (3G is 3-gigabytes, 512M = 512-megabytes, etc.). Also, specify the desired location and name for the file. Alternately, the virtual hard-drives can be create via dd if=/dev/zero of=~/vhdd.img bs=1G count=1" which will create a one gigabyte file in the user's home folder titled "vhdd.img". Change the location, name, and size as needed. However, both of those commands create raw image files (*.img). There are ways to create virtual hard-drive files of other formats as seen below.
Template: qemu-img create -f TYPE /PATH/AND/FILENAME SIZE
cloop - Compressed Loop format (Knoppix and other live-distro images)
cow - Copy-On-Write (very old version; use qcow2 instead)
qcow - Qemu Copy-On-Write (older version)
qcow2 - Qemu Copy-On-Write (newer version)
vmdk - VMware image; formats 3, 4, and 6
vdi - VirtualBox v1.1 hard-drive images
To format (apply a filesystem) an image file (*.img) in the host, use a command like "mkfs.* [parameters] /PATH/TO/FILE". For example, to format an image file in the current directory to Fat32, type "mkfs.vfat -s 16 -F 32 ./vhdd.img". To mount that same image file in the host, type mount -t vfat -o loop,rw ./vhdd.img ~/vdrive/. Remember, the host and Qemu cannot use/access the same virtual hard-drive simultaneously.
Once a virtual hard-drive is ready, users can boot from an ISO file, another virtual hard-drive, or a real storage unit (like a live-CD). For instance, to boot from a live-disc (like ReactOS), type "qemu-system-i386 -hda ./vhdd -cdrom /dev/sr0 -m 512 -boot d" after inserting the live-CD. The "-boot d" parameter informs Qemu to boot from the virtual cdrom/disc. The real cdrom is set to also be the virtual cdrom (-cdrom /dev/sr0). The virtual hard-drive is set as the virtual hard-drive (-hda ./vhdd -cdrom). 512 megabytes of real memory is dedicated to the virtual machine (-m 512). The Qemu command used is "qemu-system-i386" which is for i386 guests. The different commands for various architectures are listed below.