After some time using VMWare Workstation as a playground for my VM home lab environment, and after learning and testing with VM ESXi Hosts, I decided that is time to move to a hardware lab.

So I achieved, for the start, 2 servers for the ESXi hosts, and because there is no HDD on the servers, I have installed the ESXi software on an USB Stick. For the storage I would like to use a dedicated shared server, but I am still looking what server and drives should I get. I need more time to check and see what would be the best solution for me.

But in the same time, I am not having enough patience to wait till I build my storage server, I would like to start testing the ESXi hosts right away. I know that this is a compromise solution, but I thought to attach a USB Disk as VMFS Datastore.

So in today’s post I would like to show you how can we add and configure a USB Disk as VMFS Datastore.

Note

Please note that in the ESXi 6.7 version, USB devices larger than 2TB are not supported.

Step one – Enable SSH access to ESXi host

Connect to ESXi IP address, go to Actions and then select Services and Enable Secure Shell (SSH).

Step two – Connect to ESXi host using SSH

With your preferred SSH client, mine is Putty, start a connection to the ESXi host.

Step three – Stop USB Arbitrator

You have to stop USB Arbitrator Service. The service is used to passthrough the USB devices from hosts to a virtual machine. Once stopped, you will not be able anymore to passthrough USB devices to VMs.

# /etc/init.d/usbarbitrator stop

To maintain the stopped status of the service after reboot, insert the command:

# chkconfig usbarbitrator off

Step four – Plug in the USB device to the ESXi host and get the device identifier

Connect USB device to the ESXi host. Then get the device identifier by issuing the following command in Putty:

# ls /dev/disks/

First USB device is the stick which is booting the ESXi software, so the second device is the USB Disk that we’d like to use for the datastore – mpx.vmhba33:C0:T0:L0

Step five – Write a label to the device

Write a gpt label to the USB device using its ID

# partedUtil mklabel /dev/disks/<deviceID> gpt

Step six – Create partition

In order to create the partition, we need to have a few info:
1. The start sector: 2048
2. The GUID for VMFS: AA31E02A400F11DB9590000C2911D1B8
3. The end sector. This one should be calculated.

To calculate the end sector, we’ll issue the following command first:

# partedUtil getptbl /dev/disks/<deviceID>

Use this formula to get the end Sector:
243201 * 255 * 63 – 1 = 3907024064

Or you can use this formula:

# eval expr $(partedUtil getptbl /dev/disks/<deviceID> | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1

Now we have all the info and we can create the partition using the command:

 # partedUtil setptbl /dev/disks/<deviceID> gpt "1 2048 <endSector> AA31E02A400F11DB9590000C2911D1B8 0"

Step seven – Format partition with VMFS6

We’ll format the partition now with VMFS6. Please be aware that we have “:1” after the deviceID.

# vmkfstools -C vmfs6 -S USB-Storage /dev/disks/<deviceID>:1

Step eight – Check Datastore in ESXi

Return to ESXi and check the Storage tab. You should see here the new Datastore.

We have managed to add the USB-Disk as VMFS Datstore and we can now deploy VMs on it. I will proceed with the installation of vCenter Appliance.

Source

Share:

37 comments

  1. Hello,
    I successfully created a datastore on an external usb drive. Then I unmounted it to attach to another host. The host only saw the device in the Storage devices. I could not mount the USB drive, nor the datastore to the new esxi host. I have not found any answers, have you?

    1. hello Ioan, same problem as Carlos – Was able to create a USB datastore successfully on one ESXi host, but unable to read the drive on another host. It’s just recognized as a USB storage device with one VMFS partition (naa.xxxxxxxxxx). Any idea how this datastore can be mounted on another ESXi host?

      1. Log on to ESXI cli and execute:

        esxcli storage vmfs snapshot list

        From that grab the UUID displayed

        Then run:

        esxcli storage vmfs snapshot mount -u

  2. Hi, so I can see a device vmhba33 as a new one after connecting the drive, but partedUtil results with error message “Could not stat device /dev/disks/vmhba33 – No such file or directory” and “Unable to get device /dev/disks/vmhba33 even though ls /dev/disks shows it (as mpx.vmhba33:C0:T0:L0)

  3. Thank you, was struggling getting this to work, found your instructions and followed them without any issues

  4. I’m running into a bunch of very weird issues that I believe may be related to my USB ports on the system and/or the usb enclosure. Basically, any version of Windows Server 2016-2019 (verified that my ISOs are good) that I install, it has a whole bunch of install errors and/or if it installs fine, it’s a black screen after login. I can sometimes start task manager at this black screen and try to run something but it never shows whatever I ran as a command. It’d be easier to try something if this wasn’t a system I’m remote to.

    Could it possibly be related to the ‘queue depth’ showing for the USB device under storage -> devices which shows only a value of 1? I’m curious what other people are seeing for their ‘queue depth’ for the usb hdd. Performance wise, I’ve tested and get about 30MB/sec.

    Are you storing and running more than 1 vm off the usb hdd?

    I just can’t explain the issues with these Windows installs. I installed a version of Ubuntu which didn’t have any install errors but noticed that X hours later, the vm itself is also pretty much non-response if I try to do anything with it.

    1. I forgot to mention that this is a HP T730 machine. It has a 32GB m2 flash/ssd which I have pfsense running fine on. Due to space limitations on the built in flash/ssd, I am not putting anything else on this volume.

      1. Hey Doge, all my VMs are running on a SSD Storage. I am using the USB Storage only to keep the VMs in the poweroff state.
        Sorry, don’t know what to say about this issue…

  5. Thanks for your article.
    I have one question. If you use a usb drive for datastore and turn the arbitrator off, how is it it possible to use other usb devices (usb network adapter) with passtrough for a host ?

  6. Thanks for the article. Performed steps exactly as outlined in a test environment and worked from the first attempt. No issues whatsoever.

  7. Has anyone figured out how to move your USB connection to another/different host and mount this same drive as a vmfs without losing data? Ex. Clone a vm to the USB drive, drive it to a DR site, plug it into a different host, and mount it to migrate it into your DR environment.

    1. Log on to ESXI cli and execute:

      esxcli storage vmfs snapshot list

      From that grab the UUID displayed

      Then run:

      esxcli storage vmfs snapshot mount -u

  8. Hi there, I have tried to follow the procedure described but I am getting the following error at step 7:
    [root@localhost:~] vmkfstools -C vmfs6 -S USB-Storage /dev/disks/mpx.vmhba33:C0:T0:L0:1
    create fs deviceName:’/dev/disks/mpx.vmhba33:C0:T0:L0:1′, fsShortName:’vmfs6′, fsName:’USB-Storage’
    deviceFullPath:/dev/disks/mpx.vmhba33:C0:T0:L0:1 deviceFile:mpx.vmhba33:C0:T0:L0:1
    ATS on device /dev/disks/mpx.vmhba33:C0:T0:L0:1: not supported
    .
    Checking if remote hosts are using this device as a valid file system. This may take a few seconds…
    Creating vmfs6 file system on “mpx.vmhba33:C0:T0:L0:1” with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label “USB-Storage”.
    Failed to create VMFS on device mpx.vmhba33:C0:T0:L0:1
    Usage: vmkfstools -C [vmfs5|vmfs6|vfat] /vmfs/devices/disks/vml… or,
    vmkfstools -C [vmfs5|vmfs6|vfat] /vmfs/devices/disks/naa… or,
    vmkfstools -C [vmfs5|vmfs6|vfat] /vmfs/devices/disks/mpx.vmhbaA:T:L:P
    Error: No such device or address
    [root@localhost:~]

    Any clues?
    thanks a lot!

  9. Thanks! It’s a pleasure when a guide is so well explaines as this one.
    I could install an ESXi machine inside a virtual ESXi inside a “physical” ESXi (3 levels of nested virtualization).
    I have a question, since I’d like to get one more level: is it possible to stop USB Arbitrator only for one USB device?
    I am using one USB as a datastore for the virtual ESXi that is hosting another virtual ESXi.
    Now I want to pass a USB to this first virtual ESXi so the second virtual ESXi can use it as datastore and be able to deploy another virtual ESXi (4 levels).

    Thanks a lot!

  10. Is there any way to do this without stopping the USB Arbitrator for ALL devices? I want to be able a couple of USB radio devices with a VM.

  11. (ESXI 6.7 is running on a USB drive) I am trying to create a datastore on the same USB drive the ESXi host OS is also running on. I went through the steps, created the datastore with no issues, then when I rebooted, it would no longer boot off the thumbdrive. Do we need to create a smaller partition so the OS can still work?

Leave a Reply

Your email address will not be published. Required fields are marked *