Most of the time, tutorials on the Internet explain how to connect a physical (real) USB key to a virtual machine for use from the virtual machine.
However, we recently noticed that it was possible to create virtual USB keys (in the form of ".vmdk" files) that we can then plug into our virtual machine.
The virtual machine will therefore think that it's an USB key, whereas in reality it will be a simple VMDK file on the host PC which will be plugged in connected to the virtual USB 2 (EHCI) controller of the virtual machine.
This tutorial will therefore allow you to test different programs that require an USB key without having to buy or use a real USB key.
Thus, in case of problem, your real USB key will not be in danger.
Warning : since version 16.2.1 of VMware Workstation Pro, a restriction has been added to the configuration file (.vmx) of new virtual machines.
This prevents you, by default, from connecting USB devices from the VMware Workstation Pro window.
It is therefore necessary to disable this restriction by following our tutorial "VMware Workstation 17 / 16 - Unable to connect an USB key to a VM (solution)" so that the virtual USB key can be connected to your virtual machine.
In the VMware Workstation folder, you will find a "vmware-vdiskmanager.exe" executable file which corresponds to : VMware Virtual Disk Manager.
This small utility allows you to create virtual disks in vmdk format.
To use it, open a command prompt (cmd) and navigate to the VMware Workstation folder :
Batch
cd "C:\Program Files (x86)\VMware\VMware Workstation"
Then, to create the virtual disk, we will use this "vmware-vdiskmanager.exe" program.
To know all the parameters available for this "VMware Virtual Disk Manager" program, run this program without parameter from the command prompt (cmd) or refer to the "Running the VMware Virtual Disk Manager Utility" (page 217) section of the VMware Workstation 6.0 user manual.
For this tutorial, we are going to create a 16 GB USB key for our "Win 10 v2004 Pro x64" virtual machine.
For that, we will use the command below, of which here are the explanations :
Batch
vmware-vdiskmanager.exe -c -a buslogic -s 16GB -t 0 "H:\Win 10 v2004 Pro x64\virt-usb-key.vmdk"
Once the command is executed, this will be displayed in the console.
Note : you can ignore the error about "VixDiskLib ... PhoneHome library". This message is not supposed to appear and is due to an oversight on the part of a VMware developer.
Also, this error no longer appears with recent versions of VMware Workstation Pro.
Plain Text
VixDiskLib: Failed to initialize PhoneHome library. Creating disk 'H:\Win 10 v2004 Pro x64\virt-usb-key.vmdk' Virtual disk creation successful.
Note: in some cases (perhaps depending on the version of VMware Workstation Pro used), an error may appear regarding OpenSSL.
OpenSSL allows you to manage SSL certificates and is not necessary for creating your virtual USB key.
So you can safely ignore the error below if it also appears in your case.
Plain Text
SSLConfigLoad: Failed to load OpenSSL config file.
To attach the virtual USB key to your virtual machine, you will need to modify its associated ".vmx" file, as this is not possible from the VMware Workstation GUI.
To start, stop your virtual machine (if it's not already done) and close the "VMware Workstation" window where your virtual machine appears.
In the ".vmx" file of the VM, check that these lines are present :
Plain Text
ehci.present = "TRUE" ehci.pciSlotNumber = "xx"
Informations :
In the VM's ".vmx" file, add this :
Plain Text
ehci:0.present = "TRUE" ehci:0.deviceType = "disk" ehci:0.fileName = "virt-usb-key.vmdk" ehci:0.readonly = "FALSE"
Source : Virtualizing a physical USB (boot) drive
Once the ".vmx" file of your virtual machine has been modified, double-click on it so that VMware Workstation uses the new settings there.
As you can see, your virtual USB drive doesn't appear here.
And it doesn't appear in its virtual hardware either, since it's not normally offered.
Although nothing appears in your virtual machine information, you will see informations displayed after the virtual machine is started.
Important : if your virtual USB key does not appear in the guest operating system (Windows in this case) or at the bottom right of the VMware Workstation Pro window, make sure that the USB device restriction is not is not enabled.
Indeed, since version 16.2.1 of VMware Workstation Pro, you cannot, by default, connect USB devices to your new VMs.
To disable this restriction, refer to our tutorial cited in the warning at the very beginning of this tutorial.
If you open the Device Manager, you will see your virtual USB key appear in the "Disk drives" section with the "VMware Virtual Storage USB Device" name.
When you create a virtual disk with the utility of VMware, it doesn't contain a file system (such as : FAT32, NTFS, ...) by default.
The USB drive therefore appears in the file explorer of the guest OS, but it can't be used for the moment.
To format it (and therefore create a file system on it), double-click on it.
Windows will tell you that you need to format the drive disk before using it.
Click on "Format disk".
Change the file system to use if you want, then click : Start.
Confirm the formatting of the drive by clicking OK.
Formatting is complete.
Now, our USB drive is available and has a size of 16 GB.
VMware 3/16/2013
VMware 2/7/2020
VMware 12/24/2021
VMware 12/10/2021
Pinned content
Contact
® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.
Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.
I just want to add.
If you get the "failed to create partition" error when working with it inside the VM, simply make it a deletable disk on the host.
vmware-vdiskmanager.exe -D "c:\%path%\virt-usb-key.vmdk"
You must be logged in to post a comment