Disks and images
Raw disk images on virtio-blk, opened in place or held in memory, with the options QEMU users already know.
A disk is a raw image file given with -drive. The guest sees it as a virtio block device: /dev/vda, /dev/vdb, and so on in the order the drives appear.
wemu-img create -f raw data.img 4G
wemu-system-aarch64 ... -drive file=rootfs.img,if=virtio -drive file=data.img,if=virtioRaw images only
Warm64 opens raw images: a file holding the disk's bytes, nothing else. Make one with wemu-img create; it's sparse, so an empty 4 GB image takes no space until written. Convert a qcow2, vmdk or vhd image with QEMU's own tool:
qemu-img convert -O raw disk.qcow2 disk.imgWhere the guest's writes go
A disk is served in one of two ways.
| Opened in place | Held in memory | |
|---|---|---|
| When | The host has openDisk: Node, or a browser worker using OPFS. | No openDisk (the stock browser host), or snapshot=on / -snapshot. |
| Reads and writes | Go straight to the file as they happen. There is nothing to flush. | The image is read whole; writes stay in memory and are gone when the machine ends. |
| In snapshots | The disk's bytes are not included: restore on a machine that opened the same file. | Included. |
wemu-system-aarch64 in Node opens every drive in place, so the guest's writes reach your image file. To try something without changing the image, add -snapshot:
wemu-system-aarch64 ... -drive file=rootfs.img,if=virtio -snapshotWarning A disk held in memory shares the core's memory with guest RAM: about 3.7 GB in all on the standard core. An image that doesn't fit gives the guest an I/O error.
Drive options
| Option | Description |
|---|---|
readonly=on | The guest can't write. |
snapshot=on | Keep writes in memory. |
discard=unmap | Pass the guest's TRIM and discards to the host, which can free the space in the image. |
media=cdrom | A read-only disk. It appears as a virtio disk, not a CD drive. |
if=none,id=ID | A drive for -device virtio-blk-pci,drive=ID. |
See -drive for all of them.
Note A discard reaches the image only if the host's disk supports it. The stock Node and OPFS disks don't yet, so there discards are ignored and the image keeps its size.
PCI or MMIO
By default, virtio devices sit on virtio-mmio slots, which Linux finds through the device tree. Some systems look for their disk on PCI instead. Name any device with -pci and every virtio device moves behind the PCIe host bridge:
wemu-system-aarch64 ... -drive file=disk.img,if=none,id=d0 -device virtio-blk-pci,drive=d0The machine has eight virtio slots in all, shared by disks, network cards, shared folders, the GPU, input (which takes two) and sound.
Disks in the browser
The stock browser host reads each image whole (from a URL or a blob: URL of a file the user picked) and keeps the guest's writes in memory. For disks that persist, run Warm64 in a worker and open them in the Origin Private File System. See openDisk.
What isn't there
Disks are fixed while the machine runs: no hot-plug, no eject or change, no block_resize. There are no backing files, internal disk snapshots or block jobs; savevm saves the whole machine instead.