14

We have an ESXi server standing somewhere else. I can connect to the server with the vSphere client.

There is an external USB hard drive plugged into the server.

How can I copy a stopped VM to the external hard drive?

ewwhite
  • 194,921
  • 91
  • 434
  • 799
Anatol
  • 349
  • 2
  • 6
  • 19

6 Answers6

7

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:

Craig Watson
  • 9,370
  • 3
  • 30
  • 46
7

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.

JamesRyan
  • 8,138
  • 2
  • 24
  • 36
2

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> root@esxhost:/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).

Charles Burge
  • 758
  • 6
  • 16
1

Here is another method that gets the job done but not by connecting the USB drive to the VMhost. I use this when access to the ESXi host is not convenient.

1.From vSphere click on the VM and then the summary tab.

2.Right click on the datastore found under storage and then browse datastore.

3.Right click the directory with the VM and then download. (Note this can take a long time depending on how large and other obvious variables.)

4.Once you have the directory on your desktop you can do what ever is needed.

  • hi Jason, thanks for that. that´s what i tried first, but the vm is to big to download it to my local machine. the server and usb drive are far away - I hoped to find the usb drive in the datastore window the all this would be easy – Anatol Mar 05 '14 at 19:56
  • Depending on network speed, and if you have physical access to the server they are probably pretty quick, I have found this to be the least painful process when moving a machine to an external drive or a data store. – jer.salamon Mar 05 '14 at 22:52
  • right, but exactly thats my problem, I don´t have phisical access as written the server is somewhere else, also the filesize is to big for normal internet connections. – Anatol Mar 06 '14 at 08:43
1

I needed to do this in order to migrate a physical server to AWS. I first needed to convert the physical server to a VMDK, and chose to use VMware vCenter Converter Standalone in conjunction with VMware ESXi 6.5. Both are free (atleast a full-featured free trial) and relatively simple to setup and use.

The problem was, the physical server had nearly 2TB worth of storage that I needed to convert into an EBS volume in AWS. I'm not certain why, but every time I attempted to export via the VMware ESXi web-interface, the download would fail after ~700MB.

My solution was to use SCP. In order to do this, I first had to enable SSH access on the VMware ESXi server. Next I logged into the VMware ESXi web-interface and browsed to Storage > My Big Storage Drive and obtained the path to the storage volume. enter image description here

Once that was enabled, I launched Cygwin and began the transfer:

# Make destination directory on external HDD plugged into Windows PC
mkdir -p /cygdrive/d/VMWareMachines/MyBigServer

# Copy the entire volume from the ESXi server to the external HDD
scp -r root@192.168.1.2:/vmfs/volumes/4b3dc0ea-ff5a5bd3-503d-00224d50922a/ /cygdrive/d/VMwareMachines/MyBigServer/

This estimates nearly 23 hours to complete, as I'm reading from / writing to spinning disks and over USB 2.0, however it is accomplishing my goal of copying the VMDK of my server to external media. Obviously speeds would be faster with a gigabit switch, SSD read/write and/or USB3+.

Aaron St. Clair
  • 211
  • 1
  • 3
0

Another thing we do is use another client computer. Preferably on the same subnet as the esxi host. Plug the usb drive in the client computer. install the ESXI client and connect to the host. You can browse the datastore and copy the files to the usb, but I'd recommend exporting to an OVA file.

positives: -don't need a second vm -work around for hosts that can take usb3.

Negatives: -needs network -client computer -possibly download of client software