For a lot of reasons, it may be convenient to detach or attach live disks to a running VM without having to reboot it. Sure, you can use some network based storage, but when performance counts, attaching a new virtual disk will usually give you better throughput and lower latency in a quick testing situation.
drive_add 0 if=virtio,file=/tmp/vm.qcow2,if=virtio,format=qcow2,id=rtt
Can't hot-add drive to type 7
We achieve this by setting if=none so it has no physical interface but we make QEMU aware that the virtual disk does exist.
drive_add 0 if=virtio,file=/tmp/vm.qcow2,if=none,format=qcow2,id=rtt
device_add virtio-blk-pci,drive=rtt
There should be no output which means it is all good now!
Congrats, you've now hotadded a virtual drive to QEMU without having to restart
qemu, kvm, virtual, disk, qcow, via, commandsfor, detach, attach, disks, vm, reboot, attaching, throughput, latency, doesn, drive_add, virtio, tmp, format, rtt, achieve, interface, os, referencing, defined, device_add, blk, pci, output, congrats, ve, hotadded, restart,