The following is a guest posting from Daniel Hiltgen, one of the senior developers on the ESXi product.

Did you know that you can quickly and easily transfer files to and from ESXi using basic web protocols?

Starting in version 3.5, ESXi supports HTTP based file transfer for files on any mounted datastore.  You can try this out with your favorite web browser by navigating to https://$HOSTNAME/ and clicking on the "Browse datastores in this hosts's inventory" link on the right hand side.  (Or you can link directly via https://$HOSTNAME/folder?dcPath=ha-datacenter )

Through your web browser, you'll be able to easily navigate the datastores, directories, and download files from the host.  You can upload files using any tools that support the HTTP PUT protocol (web editors for example) or you can use command line tools to make the task a little simpler and more scriptable.  (Note: directories will be created on the fly if they don't already exist when you upload.)  The interface supports the offset header, so you can restart downloads that are interrupted, or logically "chunk" a large file into multiple parts and download them in parallel to improve the download rate.  This interface is also supported against vCenter, but for the purpose of this post we'll focus on direct ESXi access.

Lets talk a little about the URL format first before we look at the scripts.  Here's an example URL on my system:


We can break this down as:

  • https://esx01      : The hostname
  • /folder                  : Tells the system you're browsing for files on datastores – this is a constant
  • /NewVM/NewVM-flat.vmdk    : The path relative to the datastore for the file in question
  • ?dcPath=ha-datacenter      : The datacenter path – always ha-datacenter for hosts, but will vary on vCenter
  • &dsName=MyRaid1Datastore   : The name of the datastore – "MyRaid1Datastore" in this case

Here's and example shell script that leverages the "curl" tool to support both uploads and downloads of files.

— Daniel Hiltgen