Mounting a USB datastore in VSphere ESXi

When I first started working with VMWare VSphere ESXi, I was surprised to discover that it does not support mounting a USB drive as a datastore. OK, maybe not that surprised given EMC’s business model, but still…

My solution:

  1. Mount the disk in a helper VM
    • Create a helper VM running Linux
    • Configure the VM to pass the USB device through to the guest
    • Mount the USB device in linux, say in /mnt/usbdrive
  2. NFS Export the disk from the helper VM
    • Enable NFS in Linux (eg yum install nfs-utils)
    • Export the disk via a line in /etc/exports like:
      /usbdrive 1.2.3.4/32(rw,sync,no_root_squash)
  3. Mount the NFS storage in the hypervisor
    • Enable NFS in ESXi
    • Create a new datastore from network storage

USB Storage on VMWare Infographic

Caveats:

  • This configuration is best used for administrative tasks like backing up/restoring/moving VMs. I don’t recommend running a live VM in this configuration.
  • Due to the risk of deadlock, it is far better to put the helper VM on a different VSphere instance.
  • Make sure to remove the VSphere datastore before powering down the helper VM. If you don’t, the datastore will hang and can’t be removed until you reboot the hypervisor.

Leave a Reply

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