The ways to connect USB device in Virtual Machine
Virtualization, i.e. technology that allows creating a virtual version of a device or a resource, such as server, storage device, network or even an operating system, has been around for years. It offers you so many benefits that it is hard to imagine now that once upon the time we lived in ‘physical only’ world. But beware – virtualization has certain shortcomings too. One of them is having no access to USB ports, i.e. in Microsoft Hyper-V, VMware USB passthrough is not possible. This means you cannot use contents of a USB dongle attached to a host computer on virtual servers, and arises a questions how to connect USB to VMware virtual machine?
There are two main ways of going about this issue:
- Using third party software solutions that pass data of USB in VMware and other virtual environments
- Utilizing integrated methods of adding USB devices into virtual machines
Software to access USB in virtual machine
There is special software that enables USB passthrough device to a virtual machine. It allows you to configure the number of virtual USB ports and connect devices of different types and different storage capacity (for USB drives). It also allows passing data of several USB ports through virtual machines. With the help of USB over Ethernet you get access to USB ports that are physically connected to the main (host) operating system of the computer where virtual OS is installed or any other remote computer no matter where it is actually located. USB Network Gate also enables you to pass data of remote USB device in virtual machine.
To create a virtual connection with the help of USB Network Gate do as follows:
- Install the application on the host and virtual machines;
- Share a USB device over network;
- Setup connection to USB device for a virtual machine.
The device is displayed in Device manager of your virtual machine and your OS sees it as it were directly inserted into your machine. One of the biggest advantages USB Network Gate offers is multiple OS support – Windows, Linux, Mac.
Connect USB device to a virtual machine
If you plug in a device into the host computer when a virtual machine is running and its window is active, the device automatically gets connected to the guest system instead of the host. You can disable the autoconnect feature in the USB Controller panel accessible via Virtual Machine Settings Editor.
If a USB device is attached when all the USB ports of the virtual machine are already occupied, a dialog box will be displayed. It will give you options either to disconnect one of the already connected devices so you can free up a port for a newly inserted device or ignore a new device. If you choose the latter, the device will be connected to the host.
If you would like to specify what USB devices are to be connected to a virtual machine, go to VM > Removable Devices. The max number of USB devices you can connect at a time is two. If a hub is used for connecting devices to the host, you will not see the hub, only the virtual devices.
Each of the USB ports has a menu item, hover over them to display a cascading menu of devices plugged into your host computer and available for use on your virtual machine. Clicking the name of a device will connect it to the virtual machine. If a device is already connected to that port, click the name of a newly attached device to release the first device and connect the new one.
To release a device, find a port to which it is connected and choose None in its cascading menu.
If a device is connected to the host machine, e.g. you plugged it into the computer while the autoconnect feature was disabled, you can connect it to the virtual machine manually via VM > Removable Devices menu.
How to mount USB drive to Hyper-V
To connect a USB drive to a virtual machine install it as virtual hard disk in Hyper-V virtual environment. You can do it if you know the size of the drive, to find it out on your host machine click Computer, find your removable disk, right-click to display the context menu and go to Properties. General tab will have information on the size of your hard drive in Bytes and GB.
How to install a USB drive as a virtual hard drive:
- Right-click on your Hyper-V server, choose New > Hard Disk, or do the same from Actions menu; follow the instructions.
- When prompted enter a name for your drive, click Next.
- Choose ‘Copy the content of the specified physical disk’ and enter the details to identify the disk.
Copying the content of the removable storage and creating the USB.vhd file might take a while, it depends on its size. The amount of free space does not matter, a vhd file is created with the entire size of the removable storage.
- Choose Settings on your virtual machine, select SCSI Controller – see the left pane; select Hard drive – see the right pane, click Add.
- Click Browse and choose to open the vhd file to which you mounted your removable storage. Your removable storage should be displayed as a drive.
If ‘My Computer’ does not show it as a removable storage, it might be because the drive is offline. To check it, go to your VM, right-click Computer, choose ‘Manage’ or ‘Administrative Tools’ and go to Computer Management.
Expand Storage and select Disk Management. Red arrow icon means that the disk is offline, right-click the disk and in the context menu displayed select Online. Once your disk gets Online status, a drive letter will be assigned to it.
There are certain drawbacks to this method: you will have to reproduce the entire actions sequence for each USB drive connected to your Hyper-V virtual environment. As we already mentioned, creating a vhd file might consume some time, it directly depends on the size of your USB disk.
USB Network Gate
Also available on macOS, Linux OS and Android , 5.62MB size
Version 8.0.1859 (5th Nov, 2017) Release notes