Guides

Disks and images

Attach disks with -drive or -blockdev, in any of QEMU's formats. Node opens them in place, and a browser fetches them.

As in QEMU, a disk is an image file you pass with -drive. With if=virtio it becomes a virtio-blk-pci disk, and the guest sees /dev/vda, /dev/vdb and so on, in the order you list the drives.

warm-img create -f raw data.img 4G
warm-system-aarch64 ... -drive file=rootfs.qcow2,if=virtio -drive file=data.img,if=virtio,format=raw

Drives work as they do in QEMU 11.1.1. That covers -drive and -blockdev with all their options, plus the images, formats and drivers described in QEMU's disk images and block drivers pages.

Formats

Warm64 supports QEMU's formats: qcow2, raw, qed, qcow, vdi, vhdx, vmdk, vpc, parallels, dmg, bochs, cloop and luks. QEMU's filter drivers work too, and in Node so do the network protocols nbd, http, https, ftp, ftps and ssh. -drive format=help lists them all. A qcow2 image has every qcow2 feature QEMU supports: backing files, compressed clusters, and the internal snapshots savevm saves into.

If a drive has no format=, Warm64 probes it and, like QEMU, warns when it's a raw image. Name the format to avoid the warning. To create images, use QEMU's qemu-img, or warm-img for raw ones.

Controllers

if=virtio is the usual choice, but QEMU's other controllers are there too. Use if=none,id=ID on the drive and drive=ID on the device:

DeviceGuest sees
virtio-blk-pciA virtio disk (/dev/vda).
virtio-scsi-pci with scsi-hd or scsi-cdSCSI disks and CD drives (/dev/sda, /dev/sr0).
nvmeAn NVMe drive (/dev/nvme0n1).
ich9-ahci with ide-hd or ide-cdSATA disks and CD drives.
usb-storage or usb-uasA USB disk, on a qemu-xhci controller.
virtio-blk-deviceA virtio disk on one of the board's virtio-mmio slots.
warm-system-aarch64 ... -device virtio-scsi-pci -drive file=install.iso,if=none,id=cd,media=cdrom,format=raw -device scsi-cd,drive=cd

Where the guest's writes go

In Node (and so in warm-system-aarch64), images are opened in place, and the guest's writes reach the file as they happen. With -snapshot, or snapshot=on on a single drive, writes go to a temporary qcow2 overlay in $TMPDIR instead, which is removed when the machine exits, as in QEMU. readonly=on stops the guest writing at all.

In a browser, browserWARMHost() fetches each image whole by URL: relative to its base, absolute, or the blob: URL of a file the user picked. The guest's writes stay in memory and disappear when the machine ends. So a page doesn't need -snapshot, and the stock browser host refuses it anyway, since it has no temporary files for the overlay. A large image uses as much memory as its size.

For disks that persist in a browser, run Warm64 in a worker and give the host an openDisk that uses the Origin Private File System.

While the machine runs

The monitor and QMP have QEMU's block commands:

  • Hot-plug: drive_add or blockdev-add, then device_add onto a pcie-root-port from the command line (as in QEMU, pcie.0 itself doesn't take hot-plug). device_del removes a disk.
  • Removable media: eject and change (QMP's blockdev-change-medium) on a CD drive.
  • Growing a disk: block_resize, and the guest's virtio disk sees the new size.
  • Block jobs: block-stream, block-commit, drive-mirror and blockdev-mirror, drive-backup and blockdev-backup, with QEMU's job states and events.
  • External snapshots: blockdev-snapshot-sync puts a new qcow2 overlay on top of a disk.
  • Exporting: in Node, nbd-server-start serves disks over NBD.

See also