Booting an ISO using QEMU

When it comes to running a virtual operating system, VMware is the first product that comes to mind. It’s been around for quite a while, it’s stable, reliable, and works extremely well. Unfortunately, it’s not free and depending on your budget, can be too expensive for you to consider. Fortunately, it’s not the only game in town. Different ways of tackling virtualization have led to a number of different software packages including VMware, Xen, VirtualPC, and Usermode Linux. Another virtualization program is called QEMU and it’s a lot like VMware in concept.

The first step is to grab QEMU from the project Web site. You can download the source or binaries for different platforms. Once the software is installed, you can install your first virtual operating system. The next step is to create a disk image:

$ qemu-img create linux.img 2G

This creates a 2-GB image file that will be used for the virtual hard drive. You can use different formats for the image file; you can even use the VMware vmdk image format. The default (raw) format is the best for Linux guest operating systems as it will only take up as much space as required.

Next, grab an ISO image of your favorite Linux distribution, or the CD-ROM it came on. In this case, the ISO image used is the Mandriva Linux 2006 DVD install image. The next step is to start QEMU and tell it to use the image and to boot from it, and at the same time, let it know that our newly created image file is the primary hard drive for this virtual machine:

$ qemu -boot d -cdrom ~/Mandriva-Linux-Powerpack-2006-DVD.i586.iso -hda linux.img

This tells QEMU to boot first off the CD-ROM (-boot d), that the CD-ROM device is an ISO image (-cdrom; or use -cdrom /dev/cdrom if you are using a real CD), and that the /dev/hda device to the virtual machine is the file linux.img.

Proceed with the install as usual; when the installation is done and you have to reboot, change the command line to something like:

$ qemu -boot c -cdrom /dev/cdrom -hda linux.img -user-net -m 256

This tells QEMU to boot off of the hard drive and to use /dev/cdrom as the CD-ROM device; it
allows networking and assigns 256 MB of RAM to the virtual machine.
Advertisements
1 comment
  1. Jeff said:

    Hi. I’m having some troubles loading a linux iso file onto the virtual hard drive. I had no trouble creating the img file in command prompt, but once i tried to boot linux onto the hard drive with this command: qemu -boot d -cdrom kubuntu.iso -hda kubuntu.img -soundhw sb16,adlib
    it spits out the errors:
    Could not open ‘\\.\kqemu’ – QEMU acceleration layer not activated: Result too large
    qemu: could not load PC BIOS ‘/c/Program Files/Qemu/bios.bin’

    even though the bios.bin file is located at that directory. I am trying to boot kubuntu as you may have saw in the script i ran, and i’m using windows 7 64 bit. I do not want to run the acceleration for qemu (kqemu) because it requires a driver to be installed and I want to use qemu portably (on an external hard drive) becuase the actual program requires no drivers.
    Could you please help me?
    Thx,
    Jeff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: