{"id":1571,"date":"2019-12-27T13:55:18","date_gmt":"2019-12-27T17:55:18","guid":{"rendered":"http:\/\/mikemartinezonline.com\/blog\/?p=1571"},"modified":"2019-12-27T13:55:18","modified_gmt":"2019-12-27T17:55:18","slug":"virtual-usb-disks-on-vmware-guests","status":"publish","type":"post","link":"https:\/\/mikemartinezonline.com\/blog\/2019\/12\/27\/virtual-usb-disks-on-vmware-guests\/","title":{"rendered":"Virtual USB-disks on VMware Guests"},"content":{"rendered":"<p>As anyone who has tried to use a USB licensing key or test USB devices in a VMware\/vSphere cluster environment knows that using a USB can be problematic. You may have dozens or hundreds of guests on multiple  hosts in you data center\/cluster; and trying to map a USB port to just one VM gets silly (and unsecure) <\/p>\n<p>Apparently there is a VMware feature available that I didn\u2019t know about or haven\u2019t read about. <\/p>\n<p>I cobbled the info below from multiple sources after a lot of research. Hope it helps some. If you have anything to add or need credit let me know.<\/p>\n<p>See <a href=\"https:\/\/communities.vmware.com\/thread\/580985\">https:\/\/communities.vmware.com\/thread\/580985<\/a><br \/>We are used to the VMware virtual disk format (vmdk-files)<br \/>This VMDK-files can be attached to a VM so that the guestOS perceives them as:<br \/>\u2013 IDE-device<br \/>\u2013 SCSI-device<br \/>\u2013 SATA-device<br \/>\u2013 NVME-device<br \/><b>Until today I was not aware of the fact that there is one more option:<br \/>\u2013 USB-device<\/b><br \/>This feature is not exposed in the GUI but using it is quite easy and straight forward.<br \/>To define an existing VMDK as USB-device you have to edit the vmx-file.<br \/>First of all make sure that you have this line:<br \/>ehci.present = \u201cTRUE\u201d<br \/>You need this line as a main switch for USB 2 ports.<br \/>You should also see a line like<br \/>ehci.pciSlotNumber = \u201c35\u201d<br \/>Do not edit this line \u2013 instead simply delete it if you want to reset the port.<br \/>If you assign a \u201cbad\u201d port you will get obscure follow-up problems \u2013 so don\u2019t do it.<br \/>Now to assign a VMDK as USB-device set this parameters:<\/p>\n<p>ehci:0.present = \u201cTRUE\u201d<br \/>ehci:0.deviceType = \u201cdisk\u201d<br \/>ehci:0.fileName = \u201cusb-vmdk.vmdk\u201d<\/p>\n<p>ehci:1.present = \u201cTRUE\u201d<br \/>ehci:1.deviceType = \u201cdisk\u201d<br \/>ehci:1.fileName = \u201cusb2-vmdk.vmdk\u201d<\/p>\n<p>Using this appears to be possible for more than one VMDK \u2013 so it maybe possible that the full range from ehci0 \u2013 ehci5 is allowed.<br \/>This is just a first guess \u2013 I need to do more research here \u2026.<\/p>\n<p>I said that this feature is not exposed in the GUI \u2013 that is not entirely correct.<br \/>Once you created the required vmx-parameters and start the VM you will see the disks appear in the list of removable devices:<br \/><a href=\"http:\/\/vm-sickbay.com\/wp-content\/uploads\/2018\/08\/usb-vmdks.png\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"191\" title=\"clip_image001\" style=\"margin: 0px; display: inline; background-image: none;\" alt=\"clip_image001\" src=\"https:\/\/mikemartinezonline.com\/blog\/wp-content\/uploads\/2019\/12\/clip_image001.png\" border=\"0\"><\/a><\/p>\n<p>Inside a guest both vmdks appear like this: (using my Linux-LiveCD with Ubuntu 14)<\/p>\n<p><a href=\"http:\/\/vm-sickbay.com\/wp-content\/uploads\/2018\/08\/usb-device.png\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"136\" title=\"clip_image002\" style=\"display: inline; background-image: none;\" alt=\"clip_image002\" src=\"https:\/\/mikemartinezonline.com\/blog\/wp-content\/uploads\/2019\/12\/clip_image002.png\" border=\"0\"><\/a><br \/>During my experiments I noticed that the USB-vmdks may appear in a write protected mode.<br \/>At the moment I cant claim to have completely understood in which constellation the vmdks are write-protected.<br \/>This will require further research \u2026.<\/p>\n<p>Anyway \u2013 even at the moment I would call this an extremly useful \u201cnew\u201d feature.<\/p>\n<p>1. for all those guys that develope USB-bootable tools<\/p>\n<p>If the USB-vmdks are created with the monolithicFlat VMDK-format the USB-images can be easily transferred to real USB-devices with a simple dd-command.<\/p>\n<p>2. for all users who are looking for a way to assign VMDKS&nbsp; as \u201coptional\u201d<\/p>\n<p>A USB-vmdk is allowed to be temporarily unavailable !!!<br \/>All other options to assign VMDKs will fail if the file is not present.<br \/>With USB-vmdks the VM will start even if the file is not available.<br \/>This will open new paths to acchieve obscure constellations that were impossible until now.<\/p>\n<p>3. for all users that missed the option to assign single-partition images as a VMDK.<\/p>\n<p>All other options to assign VMDKs usually require a partitioned image including a valid MBR or GPT.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As anyone who has tried to use a USB licensing key or test USB devices in a VMware\/vSphere cluster environment knows that using a USB can be problematic. You may have dozens or hundreds of guests on multiple hosts in you data center\/cluster; and trying to map a USB port to just one VM gets &hellip; <a href=\"https:\/\/mikemartinezonline.com\/blog\/2019\/12\/27\/virtual-usb-disks-on-vmware-guests\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Virtual USB-disks on VMware Guests&#8221;<\/span><\/a><\/p>\n","protected":false},"author":587,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[277,181,182],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts\/1571"}],"collection":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/users\/587"}],"replies":[{"embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/comments?post=1571"}],"version-history":[{"count":1,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts\/1571\/revisions"}],"predecessor-version":[{"id":1572,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/posts\/1571\/revisions\/1572"}],"wp:attachment":[{"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/media?parent=1571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/categories?post=1571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikemartinezonline.com\/blog\/wp-json\/wp\/v2\/tags?post=1571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}