Move VM Guest from one ESXi host to another ESXi host

Move VM Guest from one ESXi host to another ESXi host

  • Posted by DIY Chris
  • On February 27, 2021
  • esxi, esxi move vm, guest, move, move virtual machine to another host, move vm from one host to another, virtual machine, virtual machine move, vm move, vmware, VMware move guest

I’ve recently found myself needing to move some of my guest VM’s from one of my ESXi hosts to another to try and consolidate.

I am running ESXi 6.5 U3 on both servers so I can’t use the vSphere client software to move the guest VM’s and I don’t want to bother with installing vSphere server.

Luckily there is another way that I discovered while searching on Google but as always, its always only half of the info you need to complete the procedure from beginning to end. So I decided to put my thoughts into writing before the completely escape my mind because as we all know, once we get something to work we tend to forget how we did it 3 months later.

Please continue to read below for a full step-by-step solution for moving a guest VM from one ESXi host to another ESXi host.

Enable SSH server on both ESXi hosts

  1. Login to each of your ESXi servers web interfaces and then click on Host at the top right
  2. Click Actions -> Services -> Enable Secure Shell (SSH) if not already enabled.

Enable the SSH client on the host that we want to move the guest VM’s from

  1. Open a Terminal or Command window depending on OS or use your favorite ssh client software
  2. Connect to the Host server that you wish to move a guest from via SSH
  3. Press enter, you will be prompted for the password of the account that you are logging into your server with.
  4. Check if SSH client service is enabled. Will return ‘False’ if ‘Disabled’.
    esxcli network firewall ruleset list --ruleset-id sshClient
  5. Press enter, if you get a ‘False’ response then you need to run this next command otherwise proceed to the next step!
    esxcli network firewall ruleset set --ruleset-id sshClient --enabled=true

Copying your guest VM

  1. Before you can copy your guest VM, you’ll want to be sure that it is turned off. So do that first
  2. Connect to your source ESXi host (the one you are copying from) via your favorite ssh client software or use a Terminal if you’re on Mac or Linux
  3. Navigate to your datastore where your guest VM resides. For me this looks like this.
    cd /vmfs/volumes/datastore1/
  4. Make sure you know the path to your datastore on the ESXi host that you are copying the VM to. For me this is the same as my source host. Then type the following command on the source ESXi server
    scp -rv /vmfs/volumes/datastore1/NAME_OF_GUEST
  5. Press enter, you should be prompted for a password and then the copy process begins. Wait for it to finish all the way!

Register the guest VM on the new ESXi host

  1. Go to the web interface of the server that you moved the guest VM to.
  2. Go to Virtual Machines
  3. Click Create / Register VM
  4. Select Register an Existing Virtual Machine
  5. Click on “Select one or more virtual machines, a datastore or a directory”
  6. Select the folder of the VM Guest you moved to the new server
  7. Click on select
  8. Click Next
  9. Click Finish

When you turn on the VMWare Guest for the first time on the new host you will be prompted to answer if you Moved or Copied the guest machine. Leave the default “I Copied It” and click Answer

If all went well you should have been able to successfully move your VMWare guest from one ESXi host to another.


Leave a Reply

%d bloggers like this: