Leoyzen / KVM-Opencore

Opencore Configuration of KVM Hackintosh with tweaks
GNU General Public License v3.0
450 stars 160 forks source link

hotplug a sata/virtio disk to macOS #20

Closed blarrow closed 2 years ago

blarrow commented 2 years ago

I want to hotplug a new disk to macOS, and I test sata and virtio hotplug, but it not works. On qemu side the new disk is already attached with monitor info block shows. But on guest macOS side do not find the hotplug new disk. Does anyone know about this issue, is it related to OpenCore?

Version Lists:

pve7 with QEMU6.0.0 thenickdude‘s KVM-Opencore V13, OpenCore is 0.7.0 macOS 12.1

sickcodes commented 2 years ago

https://github.com/sickcodes/Docker-OSX#mount-usb-drive-hotplughot-plug-usb

Start your container.

Pick a port, for example,7700.

lsusb to get vid:pid

On Linux: sudo usbredirserver -p 7700 1e3d:2096

Now, in the Docker window hit Enter to see the (qemu) console.

You can add/remove the disk using commands like this, even once the machine is started:

chardev-add socket,id=usbredirchardev1,port=7700,host=172.17.0.1

device_add usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=4
blarrow commented 2 years ago

https://github.com/sickcodes/Docker-OSX#mount-usb-drive-hotplughot-plug-usb

  • Mount USB Drive (Hotplug/Hot Plug USB)

Start your container.

Pick a port, for example,7700.

lsusb to get vid:pid

On Linux: sudo usbredirserver -p 7700 1e3d:2096

Now, in the Docker window hit Enter to see the (qemu) console.

You can add/remove the disk using commands like this, even once the machine is started:

chardev-add socket,id=usbredirchardev1,port=7700,host=172.17.0.1

device_add usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=4

Thanks!

Finally, I use usb-storage as the target device instead of virtio-blk/nvme.

  1. add a qemu-xhci controller: -device qemu-xhci,id=xhci,bus=pci.1,addr=0x1e

  2. hot plug/unplug a usb-storage device drive_add 0 file=vm-102-disk-hot.qcow2,if=none,id=drive-hotplug,cache=writeback,aio=io_uring,format=qcow2 device_add usb-storage,drive=drive-hotplug,id=usb1,bus=xhci.0