Popular Searches

How to use QEMU to boot another OS

QEMU logo.

That old legacy system is gone, never to be heard from again. Right? But what do you do on the fateful day that someone needs to access data that’s trapped in an old legacy application? If modern applications can’t read the data, you need to run the legacy system. And that’s where system emulation comes in.

The open-source PC emulator QEMU is included by default in most mainline Linux distributions, but you can also download versions of QEMU for other Linux distributions. If you run Windows or macOS, the QEMU website provides packages for those platforms, too. QEMU provides excellent system-level compatibility and support, making it an ideal and lightweight virtual machine environment.

Set Up a Virtual Disk

You’ll need a place to install the legacy system inside QEMU, and for that you’ll need a virtual C: drive. In DOS, just as in Windows, drives are represented as letters. A: and B: are the first and second floppy disk drives, and C: is the first hard drive. Other media, including other hard drives or CD-ROM drives, are assigned D:, E:, and so on.

Under QEMU, virtual drives are image files. To initialize a file that you can use as a virtual C: drive, use the qemu-img command. To create an image file that’s about 200MB, type this:

$ qemu-img create image.img 200M


Unlike PC emulator systems like VMware or VirtualBox, you need to “build” your virtual system by instructing QEMU to add each component of the virtual machine. QEMU uses command line options to define everything. This can make QEMU difficult to use at first, but this provides flexibility in creating exactly the virtual machine that you want. To get started, you only need to know a few parameters to start a virtual machine:

1. The command to start QEMU

To emulate a legacy PC system, use qemu-system-i386 . To emulate a more modern system, use qemu-system-x86_64 .

2. The virtual disk

Use -hda imagefile to tell QEMU to use imagefile as the hard drive image. This should be the same virtual disk you defined with the  qemu-img  command.

3. The boot ISO

Set -cdrom isofile to define the CD-ROM or DVD image file. For example, this might be the bootable ISO image to install Linux, Windows, or another operating system.

4. Memory

Set the amount of memory in the virtual machine with the -m size option. If you do not explicitly set this, QEMU defaults to 128 MB. You can also append a suffix of M or G to specify the memory in MB or GB.

5. Boot order

Use -boot [options] to specify the order that QEMU should look for bootable devices. For example, set -boot order=dc to tell QEMU to try the CDROM ( d ) first, then the hard drive ( c ).

Put It All Together

Now that we have the essentials to start a virtual machine with QEMU, we can put it all together on a single command line to create and boot your virtual machine!

Let’s try it with an example: installing a copy of the FreeDOS operating system. FreeDOS is an open source DOS-compatible operating system that you can use to run legacy business software and other DOS applications. Any program that works on MS-DOS should also run on FreeDOS.

First, download a copy of the FreeDOS 1.2 install CD-ROM from the FreeDOS website, as FD12CD.iso.

Then define a virtual disk with the qemu-img command:

$ qemu-img create image.img 200M

Use that virtual disk in the command line to start QEMU:

$ qemu-system-i386 -hda image.img -cdrom FD12CD.iso -m 16M -boot order=dc
Booting the FreeDOS 1.2 installer in QEMU
Booting the FreeDOS 1.2 installer in QEMU.

And follow the prompts to install FreeDOS:

Starting the FreeDOS 1.2 installer in QEMU
Starting the FreeDOS 1.2 installer in QEMU.
Completing the FreeDOS 1.2 install in QEMU
Completing the FreeDOS 1.2 install in QEMU.

And now you have a running DOS system!

Running FreeDOS 1.2 in QEMU
Running FreeDOS 1.2 in QEMU

QEMU and FreeDOS make it easy to run old DOS programs under other operating systems, including Linux. Once you’ve set up QEMU as the virtual machine emulator and installed FreeDOS, you should be all set to run your favorite classic DOS programs from Linux.

Jim Hall Jim Hall
Jim Hall is an innovative, high-achieving Senior IT Leader with over 25 years' experience in Linux, open source, and IT Leadership. He has contributed to dozens of open source projects as developer or maintainer, including FreeDOS and GNOME. Jim is also CEO at Hallmentum, where he empowers IT Leaders to drive meaningful change through hands-on training, workshops, and coaching. Read Full Bio »

The above article may contain affiliate links, which help support CloudSavvy IT.