Move VMs between ESXi Hosts with SSH

Posted by erwin on Wednesday, October 31, 2018

Recently is had some issues with capacity and old server hardware. I created some new ESXi hosts and wanted to move the VMs to the new hosts. Below i will describe how i obtained this:

Setup Access

Start SSH and ESXi Shell on both servers, you can do this from the Web UI, Hosts > Actions > Services

Now create the destination folder (mostly VM name) on the new ESXi host.

Connect with SSH to the source ESXi host. Check if you have shutdown the VM you are going to copy!

Enable SSH client (CLI method). Check if SSH client service is enabled. Will return ‘False’ if ‘Disabled’.

    `esxcli network firewall ruleset list --ruleset-id sshClient`

Then enable SSH client. esxcli network firewall ruleset set --ruleset-id sshClient --enabled=true

Copying the VM

Go to the to the VM directory:

    `cd /vmfs/volumes/datastore1/VMNAME`

Run Command:

    `scp -v -c aes128-ctr -r * [root@](mailto:root@`

This will (if it connects properly) prompt for the root password.

Once connected it will display progress ETA and speed.

comments powered by Disqus