VMware vSphere

 View Only
  • 1.  Virtualizing a physical USB (boot) drive

    Posted Aug 02, 2020 05:57 PM

    Aloha,

    I am using Windows 10 and VMware Workstation 15 Pro and I want to virtualize a complete physical USB drive (not only the data/partitions on it but the whole(!) drive) in order to implement it as hard drive (VMDK) in a VM in VMWare Workstation (and later in a VM in ESXi). The whole implementation should simulate a USB boot process (so the USB drive is actually bootable) without needing the actual physical USB drive anymore. There are many reasons for this... the most important is to get rid of needing USB ports and non-reliable USB sticks.

    Therefore I've prepared the USB stick with a bootable partition, tested if it works and created a DD image of the whole 4 GB stick with this command:

    dd if=\\?\Device\HarddiskVolumeXX of=d:\usb-image.img --progress

    It finished without issues.

    Now I need to implement/convert this DD image to VMDK (I guess). After some searching I converted the .img to .vmdk with the help of a competing product:

    VBoxManage convertfromraw usb-image.img usb-image.vmdk --format VMDK

    Then I added this .vmdk as existing IDE hard drive to a VM in VMware which worked but as soon as the VM tries to start it prompts "Boot error".

    Can you tell me what I did wrong or is my approach not possible?

    Thanks in advance!



  • 2.  RE: Virtualizing a physical USB (boot) drive

    Posted Aug 02, 2020 08:26 PM

    After some further tests I tried it by copying the USB drive directly instead through DD, so I used this command:

    VBoxManage convertfromraw \\.\PhysicalDriveX usb-image.vmdk --format VMDK

    X = number of device in Windows disk manager

    That fixed the "Boot error" but somehow the booting linux (unRAID) does not recognize its own partition name ("dev/disk/by-label/UNRAID") anymore. I even checked in another VM if the label has changed but it has not. Now, without finding itself correctly, unRAID is booting but not working.

    Is there a proper way to emulate a real USB mass storage device without the need of the physical pendant?



  • 3.  RE: Virtualizing a physical USB (boot) drive

    Posted Aug 02, 2020 09:59 PM

    Dont know if it works with a win10 host ...

    you can assign a vmdk as usb device instead of ide,sata,scsi or nvme.

    I dont have my notes here at the moment ...

    need to look it up



  • 4.  RE: Virtualizing a physical USB (boot) drive

    Posted Aug 03, 2020 12:16 PM

    I found this option.

    You have to check if those entries in your .vmx exist:

    ehci.present = "TRUE"

    ehci.pciSlotNumber = "XY"

    XY = some number

    Then you have to add those lines into the .vmx:

    ehci:0.present = "TRUE"

    ehci:0.deviceType = "disk"

    ehci:0.fileName = "usb_image.vmdk"

    ehci:0.readonly = "FALSE"

    I then managed to use the .vmdk like an USB mass storage device with the exception of not being able to boot directly from it (it seems VMware "connects" the device a bit too late). But with PlopKexec Boot Manager it worked.

    Now, I have the issue that the serial number for the virtual USB device is somehow randomly generated by VMware on every restart to a new number (see device manager -> drives -> virtual usb drive -> details: under property "superior" or "device instand path" or sth like that in English).

    How can I prevent that behaviour? Can I set a fixed serial number that VMware remembers on the next boot process?



  • 5.  RE: Virtualizing a physical USB (boot) drive

    Posted Aug 04, 2020 08:30 PM

    I stumbled over the possibility of setting a UUID by ESXi with

    vmkfstools -J setuuid usb_image.vmdk

    Unfortunately it returns the following error:

    DiskLib_SetUUID() failed for disk usb_image.vmdk: Failed to lock the file (16392).

    I will try to get a solution to this from the vSphere forum.



  • 6.  RE: Virtualizing a physical USB (boot) drive

    Posted Aug 04, 2020 08:54 PM

    Moderator: Rather than starting a new thread, I have moved this one to the vSphere area and archived the duplicate you created.



  • 7.  RE: Virtualizing a physical USB (boot) drive

    Posted Oct 06, 2021 04:57 PM

    Did you ever find a solution to the USB GUID changing after every reboot?  I'm trying to do find a solution also.  I ran across disk.enableUUID = "TRUE" as being a possible fix but that doesn't seem to apply to USB devices.

     

    Thanks,

    Harry



  • 8.  RE: Virtualizing a physical USB (boot) drive

    Posted Nov 14, 2022 09:46 PM

    Sorry to bump necrothread, but was a top google hit so I thought I'd weigh in

    Is there some way you can just reference the VMDK from the USB drive instead of the drive itself?

    Also, under Workstation preferences, you can set a USB drive to automatically connect to the VM instead of the host when it's plugged in, maybe that would help.

    Good luck!