Move VM Guest from one ESXi host to another ESXi host
- Posted by DIY Chris
- On February 27, 2021
- 0 Comments
- 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
- Login to each of your ESXi servers web interfaces and then click on Host at the top right
- 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
- Open a Terminal or Command window depending on OS or use your favorite ssh client software
- Connect to the Host server that you wish to move a guest from via SSH
- Press enter, you will be prompted for the password of the account that you are logging into your server with.
- Check if SSH client service is enabled. Will return ‘False’ if ‘Disabled’.
esxcli network firewall ruleset list --ruleset-id sshClient
- 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
- Before you can copy your guest VM, you’ll want to be sure that it is turned off. So do that first
- 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
- Navigate to your datastore where your guest VM resides. For me this looks like this.
- 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 email@example.com:/vmfs/volumes/datastore1/
- 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
- Go to the web interface of the server that you moved the guest VM to.
- Go to Virtual Machines
- Click Create / Register VM
- Select Register an Existing Virtual Machine
- Click on “Select one or more virtual machines, a datastore or a directory”
- Select the folder of the VM Guest you moved to the new server
- Click on select
- Click Next
- 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.