建议使用第二种的web操作,方便简单直接。 命令行可以作为参考
事件:**部门需要在虚拟机上使用key,只能通过宿主机进行映射处理。
解决方案:
1、 可以通过命令行
参考:https://pve.proxmox.com/wiki/USB_physical_port_mapping
#在宿主机上查看USB设备
root@node2:~# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
|__ Port 10: Dev 6, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 4: Dev 8, If 0, Class=Mass Storage, Driver=usb-storage, 12M
|__ Port 4: Dev 8, If 1, Class=Chip/SmartCard, Driver=, 12M
|__ Port 2: Dev 9, If 1, Class=Chip/SmartCard, Driver=, 12M
|__ Port 2: Dev 9, If 0, Class=Mass Storage, Driver=usb-storage, 12M
|__ Port 14: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 4: Dev 5, If 0, Class=Hub, Driver=hub/4p, 480M
#进入到VM的配置文件中
root@node2:~# cd /etc/pve/qemu-server/
root@node2:/etc/pve/qemu-server# ls
165.conf 167.conf 168.conf 169.conf 170.conf 493.conf
root@node2:/etc/pve/qemu-server# cat 493.conf
#yewei - %E7%94%A8%E4%BA%8E%E9%93%B6%E8%A1%8C%E5%89%8D%E7%BD%AE%E6%9C%BA%E6%B5%8B%E8%AF%95%E4%BD%BF%E7%94%A8
boot: order=ide0;ide2;net0
cores: 4
ide0: vmdata:493/vm-493-disk-0.qcow2,size=100G
ide2: cdrom,media=cdrom
ipconfig0: ip=10.202.243.10/24,gw=10.202.243.1
machine: pc-i440fx-5.2
memory: 16384
name: localhost-hlgw-243010.prod.ke.com
net0: e1000=4E:F1:BF:77:E5:E6,bridge=vmbr1
numa: 0
ostype: win10
scsi1: vmdata:493/vm-493-disk-1.qcow2,size=200G
scsihw: virtio-scsi-pci
smbios1: uuid=04b142ef-0568-4a4b-b1cb-3a813eed0f2f
sockets: 2
usb0: host=1-10.2,usb3=1
usb1: host=1-10.4,usb3=1
vmgenid: 0e57fa83-8a26-4dbf-91d2-285f5b6578af
root@node2:/etc/pve/qemu-server#
10.2 通过web实现,
选中VM-点击硬件-USB设备-使用USB端口-选中即可。 注意:如果你的U盘或者可以不是3.0 ,记得取消使用USB3.0
注意:映射之后,重启是不生效的,必须关机后,再开启。使用USB3.0的选项去掉