1

I was trying to script a snapshot backup of running VMs to a USB drive attached to the host. We are using the free hypervisor version of ESXi and do not want to purchase 3rd party products to do this.

As it appears that ESXi Shell doesn't have VM snapshot commands available on 5.1, I was trying to use vSphere PowerCLI on windows to connect to the host and make a snapshot of the VM then copy the snapshotted disk to USB mounted on the host. I can get the VM snapshot in place but I can't seem to get the USB drive to show up and format VMFS accordingly.

I understand I will need to disable the USB arbitrator to do this (which I did from ESXi shell). But I am struggling to get the USB mounted and formatted and also not sure what copy command I can use after this is mounted.

Any ideas/help much appreciated.

Adam

SysAdman
  • 55
  • 1
  • 2
  • 7

2 Answers2

2

You're getting a "fault.RestrictedVersion.summary" error, right? PowerCLI and most of the SDK tools will not work on a free version of VMware ESXi. Their assumption is that people who want automation will pay the ~$500 for the most basic ESXi license...

SSH to the ESXi host and run:

vmware-cmd <vm-cfg-path> createsnapshot <name> <description> <quiesce> <memory>

For example:

vmware-cmd /vmfs/volume/datastore1/Windows2008/Windows2008.vmx createsnapshot "snap1"

Edit:

Direct USB drives are limited to FAT and FAT16-formatted drives. You're best off running USB passthrough to an actual VM if you need drive access. If you use the generic USB passthrough, I think you're limited to USB 1.1 speeds. If you pass the entire USB controller to the VM, you'll get 2.0 speeds.

ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • Hi, Thanks for that, unfortunately vmware-cmd appears deprecated on 5.1, I putty on to the host and tried the command but it doesn't exist. This is what steered me toward PowerCLI. Also I mentioned that I am able to get the snapshot to occur without issue using PowerCLI so this is not an API/license issue. My problem was actually that I cannot figure out how to mount the USB drive on the host directly. – SysAdman Jan 24 '13 at 14:42
  • See my edit above. – ewwhite Jan 24 '13 at 14:48
  • From what I've read on the webs is that you have to stop the USB passthrough service with `service usbarbitrator stop` and then plug in your USB stick. And then it should mount under /vmfs/volumes. Now, I say "should" because that's what their documentation says but I could never get it to work. – Safado Jan 24 '13 at 15:10
  • Only works for small USB FAT-formatted drives. – ewwhite Jan 24 '13 at 15:18
  • Thanks EWWHITE, I didn't realise the device had to be formatted prior to connecting to the host. I assumed that the device could be formatted from ESXi shell which was the cause of my confusion. The comment regarding the USB speeds based on controller or device passthrough were also interesting and something I will try to test in future. – SysAdman Jan 28 '13 at 09:15
1

I have worked around this by running a low resource linux VM, attached the USB passthrough to the linux VM, set up NFS export of the USB drive /mnt/usb then attached the host to the NFS export.

I can now use the USB as a datastore. Its longwinded but I was losing the will to live trying to get USB to show up in the host and be available to copy snapshot to.

SysAdman
  • 55
  • 1
  • 2
  • 7