deso

QEMU > Disk hot plugging

qemu-system-x86_64 \
    -device pcie-root-port,bus=pcie.0,id=pciroot \
    -device pcie-pci-bridge,id=pcibr0,bus=pciroot \
    -bios /usr/share/edk2-ovmf/OVMF_CODE.fd \
    -chardev socket,server=on,wait=off,id=qmp0,path=qmp.sock \
    -chardev socket,server=on,wait=off,logfile=monitor.log,id=monitor0,path=monitor.sock \
    -chardev socket,server=on,wait=off,logfile=serial.log,id=serial0,path=console.sock \
    -cdrom ~/Downloads/install-amd64-minimal-20240211T161834Z.iso \
    -cpu host \
    -device "virtio-net-pci,netdev=net,mac=52:55:00:d1:55:01" \
    -drive "format=raw,file=disk0.img,if=virtio" \
    -drive "format=raw,file=disk1.img,if=virtio" \
    -drive "format=raw,file=disk2.img,if=virtio" \
    -drive "format=raw,file=disk3.img,if=virtio" \
    -enable-kvm \
    -m 32G \
    -machine q35 \
    -monitor chardev:monitor0 \
    -netdev tap,id=net,ifname=vnet0,script=no,downscript=no \
    -qmp-pretty chardev:qmp0 \
    -serial chardev:serial0 \
    -smbios type=0,uefi=on \
    -smp 32 \
    -spice port=5900,addr=127.0.0.1,disable-ticketing=true \
    -vga qxl
# socat stdin,raw,nonblock,echo=0,escape=0x0f unix-connect:console.sock
# ls -1 /dev/ | grep 'vd[a-z]$'
vda
vdb
vdc
vdd
# socat stdin,raw,nonblock,echo=0,escape=0x0f unix-connect:monitor.sock
drive_add 0 file=disk4.img,if=virtio,bus=br0,id=mydrive
device_add virtio-blk-pci,drive=mydrive,bus=pcibr0
# socat stdin,raw,nonblock,echo=0,escape=0x0f unix-connect:console.sock
# ls -1 /dev/ | grep 'vd[a-z]$'
vda
vdb
vdc
vdd
vde

Sources

20:00 20.02.2024