Testing an ISO or an USB bootable drive with QEMU

If you want to test an ISO image or a bootable USB drive you just prepared, you can do it very easily thanks to QEMU with a simple command-line. Obviously, you will need to install the QEMU package first so you can use it. For example on a Debian-based distribution:

sudo apt-get install qemu qemu-system qemu-utils

For USB drive testing, plug the USB key and get the name of device (checking dmesg if necessary and ensure that the drive is not mounted automatically). Afterwards you can launch:

sudo /usr/bin/qemu-system-x86_64 -hda /dev/sdb -m 1G

For ISO testing, just get the path of your ISO image and launch:

sudo /usr/bin/qemu-system-x86_64 -cdrom /path/to/image.iso -m 1G

It will launch an emulator with 1G RAM (-m option). As it’s emulated, there is a lot of things that won’t work and I recommend you to use this only for simple testing purposes (no network access or usb port enabled by default for example). All of these can surely be configured with a more complete command-line, but I invite you to read full QEMU documentation for doing that.

Here you go 😉 !