How to Connect a USB Drive Directly to a Hyper-V VM
we will show how to connect your USB hard drive to a virtual machine on a Hyper-V host. Using this technique, you can provide a virtual machine direct access to a USB drive.
Note.
- This instruction only works for USB drives that are detected by the system as fixed. You can’t connect to VM this way USB flash drives, smart cards and other removable devices (although there is a little trick that allows you to make the system see a removable device as a hard drive).
- For these drives, you cannot create a snapshot.
- Connect an external USB drive to the Hyper-V host. The disk will appear in a system and a certain drive letter will be assigned to it.
- Open the Disk Management (diskmgmt.msc) console, right-click the drive (the left column, in our example, the ID of the 30 GB USB drive is Disk 2) and select Offline.
- Run Hyper-V Manager and open the properties of the virtual machine, to which a USB drive needs to be connected. In the SCSI Controller section, add a new disk, indicating that it is physical (Physical hard disk). In the drop-down menu, choose our 30 GB drive.Note. You don’t need to turn the virtual machine off to add a SCSI hard drive, since they support both Hot-Add and Hot-Remove technologies.
- Open the virtual machine console or connect to it via rdp. Run the Disk Manager again. As we can see, the new disk has already appeared in the system. If its status is offline, right-click it and click Online. At this point the letters of the disk partitions are not assigned. To change this, right-click a partition on the drive and select Change Drive Letter and Paths in the context menu, and then assign any free drive letter to the partition.
That’s all! We have directly connected our external USB drive into Hyper-V virtual machine and now can use it.
Important. To prevent data loss, before you physically remove the physical hard disk, make sure that no applications in the virtual machine access this disk.
Now let’s figure out how to safely remove such a USB drive if necessary.
Open Hyper-V Manager console and go to the virtual machine configuration window. In SCSI Controller, select a hard disk to be removed and click Remove. Save the changes. After that, you can physically remove the hard drive from the USB port of the Hyper-V host.
Tip. In Hyper-V on Windows Server 2012 R2/8.1 almost any USB device can enter inside a virtual machine using the Enhanced Session Mode (ESM) technology.