QEMU MicroVM machine type

From Computernewb Wiki
Jump to navigation Jump to search

The microvm is an x86 machine type in QEMU. The microvm is designed to be extremely minimalist and simplistic as possible, and to trim the "fat" of a regular QEMU VM. The machine is designed primarily for short-lived guests.


Ordinarily, QEMU emulates a full computer with all of its peripherals, usually through the i440fx or q35 machine types. The "microvm" skips this by using a machine modeled after Firecracker. microvm, for example, strips the machine of PCI and ACPI, and many of the other emulated devices are fully optional. This allows for a minimalistic machine that reduces the amount of things the hypervisor sets up and emulates, allowing it to have faster bootup times and less CPU/memory usage on the host.


It comes with and uses by default a custom BIOS, named qboot. qboot is specifically optimized to boot Linux as fast as possible and with as little instructions as possible. It's also possible to use the standard SeaBIOS as well.

Example VM

Example start up command for a MicroVM:

qemu-system-x86_64 -M microvm
  -M microvm
  -kernel vmlinux \
  -append "earlyprintk=ttyS0 console=ttyS0,115200,8n1" \
  -enable-kvm -cpu host -m 1G -smp 1 -nodefaults -no-user-config \
  -netdev tap,id=tap0,script=no,downscript=no \
  -device virtio-net-device,netdev=tap0 \
  -drive id=test,file=test.img,format=raw,if=none \
  -nographic -serial stdio \