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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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.
This is possible in a round about way but requires a 2nd VM (or server).
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.
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).
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.
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.
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 email@example.com:/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+.
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