Quick Tip: Use USB storage devices as datastore on VMware ESXi

This post was published 3 years 7 months 11 days ago, so the post may be outdated.

When attaching any kind of USB devices, the service usbarbitrator claims those devices to allow passing through USB devices into virtual machines. This is (one of) the reason you won’t see USB sticks as "Storage Devices" on your ESXi, therefore not allowing you to create a datastore on it.

But at this point you have to make a decision, as you can’t have both:

  1. Using a USB device as a storage
  2. OR having the ability to passthrough USB devices to VMs

Just to be very clear: This is NOT officially supported by VMware. You should not use datastores on USB devices in production.

If you decide to go ahead…

To temporarily workaround this, it’s possible to stop this service by using:

/etc/init.d/usbarbitrator stop

After re-plugging in the USB device, you should finally see the storage device. Then you’re able to create a datastore on it as you would do on any other storage device.

Very important to note: The service usbarbitrator starts when rebooting the ESXi host. After the reboot you would see the storage device as being "Dead" and not accessible.

You might have guessed the reason: It’s because the service started again and claimed those USB device.

For a permanent and reboot-proof solution, you can disable the UsbArbitrator service from starting with ESXi:

vim-cmd hostsvc/advopt/update Misc.UsbArbitratorAutoStartDisabled int 1

To check the state:

vim-cmd hostsvc/advopt/view Misc.UsbArbitratorAutoStartDisabled
(vim.option.OptionValue) [
   (vim.option.OptionValue) {
      key = "Misc.UsbArbitratorAutoStartDisabled",
      value = 1
   }
]

Now you can use the datastore for scratch location and for the coredump file on a USB device just fine:
file

Just why?
As I’m using vSAN in my smaller HomeLab which doesn’t support scratch location and coredump files on there, I’ve needed an alternative place to store these files to. I’ve decided to go for a simple USB stick.

So, to enable scratch location and coredump file on a datastore via CLI you can use (after datastore being mounted and accessible):

mkdir /vmfs/volumes/ieesxi01Local/.locker
vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string /vmfs/volumes/ieesxi01Local/.locker

esxcli system coredump file add -d=ieesxi01Local
esxcli system coredump file set -s -e=true

And then reboot.

Patrik Kernstock

May I introduce my self? I am Patrik Kernstock, 25 years old, perfectionist, born in Austria and living in Ireland, Cork. Me explained in short: Tech- and security enthusiast, series & movies junky. Interesting in Linux, Container-stuff and many software solutions by Microsoft, Veeam and VMware.

2 1 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x