External Drive OS Installation Using QEMU

The Problem

I want to install an OS onto an external drive. I don't want to reboot any machines from installer images in order to achieve this. Maybe that drive will be inserted into a machine later. Maybe that drive will be used as a boot device from USB. Maybe that drive will be used over USB as a VM in QEMU. Who knows? Who cares. It's not important.

The Solution

With the Devuan (obviously) installer on /dev/sdb, and an empty drive on /dev/sdc:

qemu-system-x86_64
	  -enable-kvm
	  -vga virtio
	  -cpu host
	  -m 4G
	  -drive file=/dev/sdc,index=1,media=disk,format=raw
	  -drive file=/dev/sdb,index=0,media=cdrom
	  -boot order=d
      

No idea why -boot order=d was needed, but without it, QEMU tries to boot from /dev/sdb, which makes no sense.

Thanks

Many thanks to the graciously provided assistance from the #devuan IRC channel. In particular to people who I've alas already forgotten, as I actually did this over a month ago. Sorry.


Another hastily constructed page by Phil Carmody
Home / linux / qemu.html