[ESXi] Create VMFS datastore from USB drive

Creating a VMFS (Virtual Machine File System) datastore from a USB drive refers to using an external storage device (usually a USB drive) to create a VMFS datastore, which can then be used to store the data of virtual machines. This allows you to expand the storage capacity of your virtualization server environment without the need to purchase additional storage devices. VMFS datastore is a storage area used in a virtualization environment, allowing a server to manage a large number of virtual machines and store their data on a storage array.

In this article, I will show you how to use an external USB drive to make a datastore containing virtual machine data on an ESXi server. The goal is to provide more hard drive space for the ESXi.

Follow the steps below to create a VMFS datastore from a USB drive on ESXi 7.0

1. Enable SSH Access

Review this article for how to enable SSH on ESXi

[ESXi] Configure Static IP and Enable SSH

2. Turn off passthrough for USB drives

By default on ESXi, any USB drive plugged into the server will automatically enable passthrough for the virtual machine. Therefore, I need to turn off the passthrough feature for the USB drive that I want to use as a VMFS datastore.

Login SSH to the ESXi server and check the list of usb devices

esxcli hardware usb passthrough device list

Record the Bus, Dev, VendorId, ProductId parameters of the USB drive to use in the command below to disable the passthrough function.

esxcli hardware usb passthrough device disable -d 1:3:bc2:5032

Check the list again, you will see that the Enabled parameter of the USB drive has changed to False.

3. Determine the codename of the USB drive

Next, it is necessary to determine the codename of the USB drive, set in the format mpx.vmhbaX:CX:TX:LX by ESXi.

Type the following command to see the list of hard drives

vdq -q

You can immediately identify the USB you just plugged in with the Device Identifier code mpx.vmhba32:C0:T0:L0because the first one is the built-in NVMe SSD.

4. Create VMFS datastore from USB drive

Use the following command to set the partition for the USB drive, and create the VFMS datastore. You need to edit the DEVICE_PATH entry to correspond to the codename of the USB drive specified in step 3.


partedUtil mklabel ${DEVICE_PATH} msdos

END_SECTOR=$(eval expr $(partedUtil getptbl ${DEVICE_PATH} | tail -1 | awk '{print $1 " \* " $2 " \* " $3}') - 1)

partedUtil "setptbl" "${DEVICE_PATH}" "gpt" "1 2048 ${END_SECTOR} AA31E02A400F11DB9590000C2911D1B8 0"

vmkfstools -C vmfs6 -b 1m -S USB-Data ${DEVICE_PATH}:1

5. Check Datastore on ESXi

If done smoothly, go back to the management page of ESXi, you will see an additional datastore called USB-Data.

Source: https://williamlam.com/2022/02/creating-a-vmfs-datastore-greater-than-2tb-on-a-usb-device-in-esxi.html

The above method has only been tested on ESXi 7.0U3. If you are using ESXi 6.7 or below, you can try this method: How to add a USB Disk as VMFS Datastore in ESXi 6.7 – IT-REACT

If my article has provided valuable insights and information to you, consider showing your appreciation with a virtual pat on the back or a kind message. Your encouragement will drive me to continue creating and sharing informative content. Thank you for taking the time to read!

Related Posts

Note: If you need technical support, please send your questions directly in the Discussion section below, I will reply soon. Don’t ask in Love Jog fanpage, there will be no response!

Leave a Reply

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