Using QEMU for DOS on *nix

While DOSBox is a great piece of kit, sometimes you may have more speciailised DOS needs that require the use of a VM. In my case, I use QEMU and so far things are working great.

Getting it

The first step, surprising though it may seem, is to grab QEMU. Fortunately it’s well enough known that most package managers carry it, even MacPorts and Homebrew on OS X do. Its relatively small and builds quite fast.

Creating a disk image

For my needs, raw images work just fine, plus they have the added benefit that they can be easily mounted on the host to modify its contents later.

QEMU comes with the qemu-img utility for creating disk images. This line will create a 500MiB raw disk image:

% qemu-img create -f raw dos.img 500M

Booting a virtual machine

This will start qemu with an extravagent 8MiB of RAM, dos.img as the master drive on the first virtual IDE channel (as a regular machine would probably be configured) and with our bootable PCDOS.iso image in the virtual CD-ROM.

% qemu -m 8 -hda dos.img -cdrom pcdos.iso

From hereon in, its as if you’re installing DOS on a regular machine. Relive the glory days of frequent system crashes, conventional memory ceilings, three finger salutes and those dark blue setup screens!

Mount the disk image on the host

You’ll want to shut down QEMU first (no, really?), then as root mount the disk image to a mountpoint of your choosing. *nix systems would typically employ the loopback device for this.

# mount -o loop,offset=32256 dos.img /mnt

Now you can access and transfer your precious DOS files :)


Why use QEMU over VirtualBox or other souped up virtualisation software?

QEMU is simple, no messy GUIs to get in the way. It’s portable, and the disk images it uses can be easily mounted on the host just like a regular drive without having to convert it first, even on machines that don’t have QEMU. And finally, speed isn’t really an issue with DOS, so I’d rather have the convenience ;)

Why do you run DOS Ruben?

I seem to always attract troll comments on posts such as this! One of the things I moonlight as is a DOS and CP/M guy, setting up VMs for clients so they can access data locked into obscure file formats and/or abandonware applications. Also for process control software that companies still depend upon but can’t use natively on modern hardware. And finally, Commander Keen. HAPPY?


This is one of about 5000 posts on Rubénerd. View the home page for the latest, or related posts also tagged with:

If you liked this post, feel free to buy me a coffee, leave me a comment on Twitter, or email me at Thanks :).