vSphere - copy virtual machine to external usb hard drive

Solution 1:

As ewwhite says in his comment, this is harder than it should be and is nigh-on impossible without doing a lot of advanced configuration.

This is mainly due to the fact that the underlying operating system behind vSphere (I believe it's loosely based on Red Hat Linux, but don't hold me to that!) was never designed to be a fully-featured OS - that's why it's defined as a hypervisor.

One option would be to get your hands dirty and poke around the ESXi console. You'd need to detect (try fdisk -l as a starting point) and mount the device. I'm unsure if you could even mount it, given that ESXi may not know how to handle FAT32/exFAT filesystems (I think it uses ext3 or ext4 under the hood but don't have a system to hand to check).

Failing that, you can use USB passthrough to assign the attached USB device to a Windows VM, then use the vSphere Client from within that VM to save the directory to the USB device via the Datastore Browser.

VMware Docs:

  • Connect USB Devices to an ESXi Host
  • Connecting USB Devices to an ESXi Host
  • USB Configuration from an ESXi Host to a Virtual Machine

Solution 2:

This is possible in a round about way but requires a 2nd VM (or server).

  1. Mount the USB drive using USB passthrough to a 2nd VM on the same physical server.
  2. Share the USB drive from this VM using NFS.
  3. Mount the NFS share from ESXi as network storage
  4. Copy the VM files across directly from one store to the other using vsphere client.

Using the vmxnet network driver in the 2nd VM this will max out most drives. Requires an NFS server but is much faster than using the vsphere client download option and allows you to keep thin provisioned files.

Solution 3:

As the others have said, having the thumb drive connected to your ESX host isn't going to be very helpful. However, you can copy files to another host on the network using scp (or the Windows equivalent). For a while, I was backing up my VM files using pscp, which you can get from the PuTTY download page. Specifically, I was using this command, run on a Windows server:

pscp -C -v -r -pw <password> [email protected]:/vmfs/volumes/datastore D:\localpath

This would recursively copy everything from a certain datastore to my local file system. The -C switch enables compression, which is very helpful when copying thin-provisioned vmdk files.

Be aware, however, that if you do have thin-provisioned vmdk files, they will become "inflated" when copied to your local storage (or anywhere off the datastore).