Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Virtualization / VMware / Adding External USB Storage Drive to VMware ESXi

December 18, 2024 VMware

Adding External USB Storage Drive to VMware ESXi

Sometimes it is necessary to connect an external USB storage drive (flash drive) directly to a VMware ESXi host. This might be necessary for offline transfer of virtual machine files or ISO images directly to ESXi (without using the network) or for backing up VMs to external media. This post covers connecting a USB drive to ESXi and using it as a VMFS datastore, or directly copying files from a FAT32/NTFS/Ext3 partition on an external drive.

Contents:
  • Using a USB Drive as a VMFS Datastore on VMware ESXi
  • Connecting USB drive with VMFS to ESXI
  • How to Copy Files from USB Drive to ESXi Datastore

Using a USB Drive as a VMFS Datastore on VMware ESXi

An external USB drive that is connected directly to an ESXi host can be formatted with the VMFS file system. This USB drive can be used as a data storage device to copy/transfer virtual machine files and to run VMs from the datastore. Suppose you want to connect a USB drive to an ESXi host and create a VMFS datastore on it to copy/move files and images of virtual machines conveniently.

VMware does not officially support external USB drives as VMFS datastores. Therefore, we do not recommend using them for critical systems. Also, ESXi doesn’t support USB drives larger than 2 TB.

Starting with VMware ESXi 6.5, when connecting USB devices to the host, a single USB driver, vmkusb, is used instead of several different drivers (xhci, ehci-hcd, usb-uhci, usb-storage). By default, when you connect a USB drive to an ESXi host, it becomes available to the VMs on ESXi via USB passthrough. To make the attached USB disk available for local use by the ESXi host itself, you must disable this mode:

  • It is possible to completely disable USB passthrough for all devices by stopping the USB arbitrator service.
  • Or use the advanced USB Quirks settings to make an exception in USB passthrough for a specific hardware model.
List connected USB devices:
lsusb
lsusb - find usb device ID
Copy an ID for your USB drive, formatted as follows: 0xDeviceID:0xVendorID
Disable USB passthrough for a specific USB device model, for example:
esxcli system settings advanced set -o /USB/quirks -s 0x0781:0x5571:0:0xffff:UQ_MSC_NO_UNCLAIM

You can completely disable the USB arbitrator service from the vSphere Client or via CLI:

  1. Open the vSphere ESXi host client and navigate to Manage -> System -> Advanced System Settings
  2. Find the option USB.arbitratorAutoStartDisabled and change its value to 1. USB.arbitratorAutoStartDisabled
  3. Restart ESXi.

To disable the USB Arbitrator service from the CLI:

  1. Connect to the ESXi host console via SSH;
  2. Stop the USB arbitrator service: # /etc/init.d/usbarbitrator stop
  3. No reboot required
  4. If you don’t want the USB Arbitrator to start after the host reboots, run:
    # chkconfig usbarbitrator off

VMFS datastore can be created on a USB drive from the vSphere Client GUI in ESXi 7.x and 8.x

  1. Connect a blank USB drive to the ESXi host
  2. Go to Storage -> Devices and click Rescan
  3. Verify that the local USB drive appears in the list of available storage devices.
  4. Click New Datastore and select USB disk as the storage device. Follow the wizard steps to create a VMFS datastore on a USB drive. Add local USB direct access device in VMware ESXi

If your USB device doesn’t appear in the list of available devices in the New Datastore wizard, or if you are using a version of ESXi earlier than 7.0, you can manually format the USB drive and create a datastore on it from the command line:

    1. Get the device name assigned to the USB drive on the ESXi host. Use one of the following commands:
      vdq -q
      find USB disk name in ESXi shell
      or
      ls /dev/disks/
      The name of the USB drive can be either mpx.vmhbaX or naa.X. In this example, it is mpx.vmhba32:C0:T0:L0
    2. Create a shell variable containing the full disk path. For example: DISK="/vmfs/devices/disks/mpx.vmhba0:C0:T1:L0"
    3. Create a GPT partition table on the USB storage: # partedUtil mklabel ${DISK} gpt
      All data will be deleted!
    4. Now create a partition on the disk. This requires you to specify the start and end sectors on the disk. View disk sector info:
      # partedUtil getptbl ${DISK}
    5. The start sector is always 2048. The end sector number can be calculated with the command : # eval expr $(partedUtil getptbl ${DISK}| tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') – 1In our example, it is 104856254partedUtil getptbl - check partition size

      If a partition already exists on the disk, you can delete it;

      # partedUtil delete ${DISK} 1

    6. Manually create a VMFS volume (the GUID of such a partition is always AA31E02A400F11DB9590000C2911D1B8):
      # partedUtil setptbl /${DISK} gpt "1 2048 104856254 AA31E02A400F11DB9590000C2911D1B8 0"
      partedUtil - manually creating a VMFS volume
    7. Format this partition to the VMFS6 file system: # vmkfstools -C vmfs6 -S usbdrive ${DISK}:1
      vmkfstools - create vmfs datastore
    8. Open the VMware Web Client and go to the Storages section. Your USB drive will appear in the list of available datastores. VMFS datastore on a local USB drive

Connecting USB drive with VMFS to ESXI

When a USB drive with a VMFS file system is connected to the ESXi host, it should be automatically detected and appear in the list of available datastores. In some cases, a VMFS datastore that is stored on external media may be incorrectly recognized as a snapshot.

List the datastores that have been identified as snapshots:

esxcli storage vmfs snapshot list

Find your USB drive in the list and mount it by VMFS UUID:

esxcli storage vmfs snapshot mount -u <uuid>

Now the external USB datastore should appear in the web interface.

How to Copy Files from USB Drive to ESXi Datastore

If you don’t want to change a file system on the USB drive to VMFS (there is a little trick to access VMFS from Windows), you can access files on NTFS/FAT32/EXT3 formatted partitions directly from the ESXi console and copy the files.

Disable the USB arbitrator service before connecting a USB drive to the ESXi host.

To access FAT32 formatted partitions from ESXi, you can use the mcopy tool. To access an NTFS partition on a USB drive, use ntfscat (available in ESXi 5.x and 6.x). The ext3 file system is supported natively. The basic restrictions are:

      1. FAT32 and Ext3 partitions are available to read and write;
      2. NTFS drives are read-only ( you can copy data from an NTFS USB drive to an ESXi host, but not vice versa).

To copy a file from a FAT32 USB device to ESXi, use this command:

# /bin/mcopy -i "/dev/disks/naa.5000000000000001:2" ::/some.iso /vmfs/volumes/12345678-ddd654321-4321-aaaabbbb2222/iso/some.iso

where /some.iso is a path to a file on your USB drive. The second path specifies where to place the file on the ESXi host (for example, directly to the VMFS datastore).

To copy a file from ESXi to USB, swap the paths in the command.

# split -b 3221225472 /vmfs/volumes/xx/vm1/vm1.vmdk

The main problem with FAT32 is that it does not support files larger than 4GB. Therefore, it is quite difficult to copy VMDK files of virtual machines. In this case, you can split a source file (for example, 3GB each) before copying:

# split -b 3221225472 /vmfs/volumes/xx/vm1/vm1.vmdk

Now you can copy all the parts to a USB drive and assemble them on the target ESXi host:

# cat vm1* > vm1.vmdk

To copy a file from an NTFS-formatted USB drive to an ESXi host, use the command

# /bin/ntfscat -f /dev/disks/naa.5000000000000001:2" some.iso > /vmfs/volumes/12345678-ddd654321-4321-aaaabbbb2222/iso/some.iso

The ntfscat command is missing in ESXi 7.x and 8.x, so if you need to copy VM files between ESXi and NTFS media, it is easier to copy them over the network. Connect the USB drive to any computer (Windows or Linux) and copy the necessary files via SSH (using scp, WinSCP, or similar tools).

5 comments
14
Facebook Twitter Google + Pinterest
previous post
How to Sign a PowerShell Script File (PS1)
next post
How to Repair (Rebuild) the WMI Repository on Windows

Related Reading

VMware Workstation: Slow VMs Performance on Windows

February 25, 2025

How to Migrate (Import) VMs from VMware ESXi...

July 24, 2024

Set up SSH Key-Based Authentication on VMware ESXi

April 11, 2024

Adding ESXi Host to VMware vCenter Server (vCSA)

March 4, 2024

How to Enable Copy and Paste for a...

January 23, 2024

5 comments

krish April 9, 2021 - 2:15 pm

Hi,
Thank you so much for this blog. I tried lots of blog and none of them worked but this one for copying file from USB to ESXi while the host was down. The mcopy tool worked flawlessly.
Thank you

Reply
Updating the Firmware ROM on the HP ProLiant through VMWare ESXi. - September 25, 2021 - 9:25 pm

[…] stick as a datastore to store your .zip file while you install it, you’ll just need to follow this guide to enable […]

Reply
Lee December 16, 2021 - 1:43 pm

Thanks for this post, this is the most comprehensive and simple to follow. Resolved my issue in under 15 mins

Reply
Asad January 1, 2023 - 7:58 am

NTFSCAT command not found error … ESXi 7

Reply
admin January 9, 2023 - 4:25 am

Looks like ntfscat was only available in esxi 5.x and 6.x

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Adding Drivers into VMWare ESXi Installation Image
  • Reduce Virtual Machine Disk Size (VMDK) on VMWare ESXi
  • How to Access VMFS Datastore from Linux, Windows, or ESXi
  • Recovering a Deleted VMFS Datastore on VMware ESXi/vSphere
  • Match Windows Disks to VMWare VMDK Files
  • Using iPerf to Test Network Speed and Bandwidth
  • Updating VMware ESXi Host from the Command Line (ESXCLI)
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top