You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows系统下如何通过Qemu实现USB设备(含U盘)直通?

Alright, let's break down how to pass through USB devices (including USB drives) from your Windows host to a QEMU guest. I’ve tinkered with this plenty of times, so here’s the reliable step-by-step guide:

Prerequisites

First, make sure you’ve got these squared away:

  • Install the latest version of QEMU for Windows (older versions might have wonky USB passthrough support).
  • Grab your USB device’s VID (Vendor ID) and PID (Product ID)—you’ll need these to target the right device. Here’s how to find them:
    1. Open Device Manager (right-click Start → Device Manager).
    2. Expand the "Universal Serial Bus devices" section, find your USB device (e.g., your flash drive).
    3. Right-click it → Properties → Details tab.
    4. From the dropdown, select "Hardware Ids". You’ll see something like USB\VID_1234&PID_5678—note down the 1234 and 5678 values (we’ll use them as 0x1234 and 0x5678 later).
Method 1: Command Line (Most Flexible)

This is my go-to method because it gives full control. When launching your QEMU VM, add one of these parameters to the command line:

This works even if your USB device’s bus/port changes (super handy for portable drives). Add this line to your QEMU launch command:

-device usb-host,vendorid=0xYYYY,productid=0xZZZZ

Replace 0xYYYY with your device’s VID and 0xZZZZ with its PID. For example:

qemu-system-x86_64 -hda my_vm_disk.qcow2 -m 4G -device usb-host,vendorid=0x1234,productid=0x5678

Option B: Target by Bus/Port

If you prefer targeting the physical bus/port (good for fixed devices), first find the bus and address:

  1. Open Command Prompt as Administrator and run:
    qemu-system-x86_64 -device usb-host,list=true
    
    This will list all connected USB devices with their hostbus and hostaddr values.
  2. Add this parameter to your launch command:
    -device usb-host,hostbus=X,hostaddr=Y
    
    Replace X and Y with the numbers from the list.

Pro tip: If you’re passing through a USB 3.0 device, add a USB 3.0 controller to your VM first to get full speed:

-device nec-usb-xhci,id=xhci
Method 2: GUI Frontend (Easier for Beginners)

If you hate typing commands, use a QEMU GUI like QEMU Manager or QuickEMU (Windows-compatible):

  1. Open your GUI tool and load your existing VM configuration.
  2. Navigate to the "USB" or "Peripherals" settings section.
  3. Click "Add USB Device" and select your target USB drive/device from the dropdown list.
  4. Save the configuration and start the VM—your device should show up in the guest OS automatically.
Troubleshooting Common Hiccups

If things don’t work right away, try these fixes:

  • Run QEMU as Administrator: USB passthrough requires elevated permissions—right-click your QEMU shortcut/command prompt and select "Run as administrator".
  • Eject the USB device first: If your drive is mounted in Windows, safely eject it before starting the VM. Windows locks mounted drives, so QEMU can’t grab them.
  • Check for conflicting software: Some antivirus or USB management tools might block QEMU from accessing USB devices. Temporarily disable them to test.
  • Verify controller compatibility: If your USB 3.0 device isn’t detected, make sure you added the nec-usb-xhci controller to your VM command (as mentioned earlier).

内容的提问来源于stack exchange,提问作者david moheban

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:11:58