Direct Transfer files from eSXi to ESXi using SSH

Server Rack hard disks

The other day I needed to transfer large virtual machines from a VMware ESXi 5.1 install to a 6.7. There are a couple ways to do this, some ways harder than others. For some reason, my go-to method wouldn’t work. The ESXi version 6.7 server would not mount the 5.1 version VMFS drive.

Now, copying almost a terabyte sized virtual machine from 5.1 to a NFS storage folder, and then have to copy the virtual machine again from the NFS storage folder to 6.7 would take absolutely forever. I know, because this is where I started.

Watching the virtual machine copy is like watching grass grow, and I didn’t want to use the rest of my life to do it twice.

So, lets copy the virtual machines directly via SSH!

First, I took an ethernet cable and used an used NIC interface on both servers to make a direct connection. I setup some virtual switches on each and gave them static IPs in the same subnet. I did not remove the management network from the NICs that were still connected to the primary network, as I would need to access the servers from my workstation.

You do not need to setup a special NIC for a direct SSH transfer. I was trying to utilize as much bandwidth as possible, which did work… but the RAID card became my bottleneck.

The next step, on the destination hypervisor, create the necessary root folders in the VMFS store you want to copy the virtual machines to.

Make sure the virtual machines on the source hypervisor are now powered off. You don’t want them running during the copy, as this will most definitely make your destination copies corrupt.

Time to SSH. I opened up my trusted Putty installation.
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Connected to the source hypervisor. A connection to the destination hypervisor is not needed, however SSH needs to be enabled and running on both servers.

Navigate your SSH client to the source virtual machine directory.

cd /vmfs/volumes/datastore1/VMNAME

Change datastore1 to machine the name of your source VMFS device, and VMNAME to the name of the virtual machine you’d like to copy.

Now, begin the copy.

scp -v -c aes128-ctr -r * root@<sourceIP> mailto:root@<destinationIP>:/vmfs/volumes/datastore1/VMNAME

If the syntax is correct, the SSH client will now prompt for the destination server’s root password.

You can watch the virtual machines copy process on the SSH client. Every so often the SSH connection will renegotiate the connection. This happens automatically so you do not need to babysit the copy process.

Once the virtual machine copy is complete, you can go to the destination server, register the virtual machine files, and boot up the VM. If you intend to use just your destination virtual machine, and never start up the source virtual machine again, i.e. a server migration, be sure to select “I moved it” when the destination hypervisor asks during first start up of the newly copied virtual machine.


Leave a Reply

Your email address will not be published. Required fields are marked *