VMware Cloud Community
lkujala
Contributor
Contributor

How to move a VM when Host is offline

I am testing backup and recovery scenarios with vCenter 5.5 prior to deploying a production system.

I have two esxi hosts connected to shared storage, with no FT / HA, but do have vMotion (which works very well).

One of the final recovery scenarios I am testing is one host goes down and I need to manually move the VMs to the other host.

Because there is shared storage, there is no issue with accessing the VM files from the other host.

However, I can not remove the VM from the offline host and I cannot add the VM to the existing host.

remove-vm throws error "host is offline" (obviously)

new-vm throws error "the specified key ... already exists" (obviously)

So, the questions are

1 - how do I remove a VM from inventory when the Host server is offline?

2 - how do I use new-vm to load and rename an existing vm?


There is an existing post where the solution is to remove the HOST from inventory; after which the new-vm command works.

That is fine if you really plan on decommissioning the HOST, but if the HOST is going to be restored later this just creates more recovery headaches.

When you are in "recovery" mode, the recovery procedures need to be simple and obvious.

Tags (4)
6 Replies
Anjani_Kumar
Commander
Commander

Yes you can by doing the following

1) disconnect the failed ESX

2) Remove the ESX host from the vCenter inventory (and therefore all its VMs - doesnt remove the vm's themselves off the shared storage, just from appearing in the vm inventory list)

3) browse the datastore on the shared storage area and add the virtual machines using the custom option instead of a "normal" vm and browse to the vmdks and add.


All the best,

Please consider marking this answer "correct" or "helpful" if you found it useful.

Anjani Kumar

-----------------------------------------

VMware, Windows

Consulant

Email ID : Anjani.kumar@vmwareminds.com

Website :   http://www.Vmwareminds.com

Please consider marking this answer "correct" or "helpful" if you found it useful. Anjani Kumar | VMware vExpert 2014-2015-2016 | Infrastructure Specialist Twitter : @anjaniyadav85 Website : http://www.Vmwareminds.com
lkujala
Contributor
Contributor

That is what the previous post suggested.

The problem I have with that solution is the ESXi host is removed from inventory.

Once I have the ESXi host running again, I then need to go through the process of adding the ESXi host back into inventory.

I have tried this process, it does work...

I don't like it as it seems like a rather convoluted method to solve a typical problem; did VMware hire a bunch of people from Microsoft recently?

0 Kudos
GuilhermeAlves
Enthusiast
Enthusiast

lkujala, here we do the same. Remove the failed esxi from inventory and add manually the Vms to another host by browsing datastore and using the "Add to Inventory" Option when clicking on the .vmx file.

You say you can not remove the VM from the offline host and add to the existing host. Try to remove the first host from inventory before adding the VMs to the new one. Have you try that? This is almost equal to Anjani's post up here but it Works for me like a charm. 😃

lkujala
Contributor
Contributor

The procedure does work.

0 Kudos
satishchirala
Enthusiast
Enthusiast

for a in $(vim-cmd vmsvc/getallvms 2>&1 |grep invalid |awk '{print $4}'|cut -d \' -f2);do vim-cmd vmsvc/reload $a;done

0 Kudos
TexK
Contributor
Contributor

deleted

0 Kudos