vSphere Orphaned VM – How to Restore Orphaned Virtual Machine in vSphere

orphansvmware-vsphere

I have a problem. My vSphere 4 host virtual machine is powered on, but is not accessible via the network (I don't know what is wrong with it, for reasons that will soon become clear).

Because my vSphere host is clearly in a bad state, I can't connect to the vSphere centre to manage my cluster. So I logged onto each blade in the cluster (all 10 of them, ESXi 4), and I can't find the vSphere VM listed in any of their individual inventories.

Which makes me believe that the VM is orphaned, but still powered up, on one of the blades.

Is there any way I can get the machine back into a local blade's inventory? I know I can add it to the inventory by browsing the SAN datastore, but I won't be able to start it if it's already running on another blade!

Best Answer

Jump onto the service console on each ESX host and run vm-support -x to get a list of all VMs that host is running or things it is running.

You should be able to ID the correct host. If it doesn't show up on any host, then none of them is running it and you should be try the 'add to inventory' route to re-attach it.

On the other hand if you do find it, you can make a note of the VMID then run the following to bring it down:

  • less /proc/vmware/vm/{Enter VMID Here}/cpu/status
  • Scroll over to the right until you find a piece of text in the format vm.####
  • Make a note of the 4 digits show in this text. This is the Master User World ID. It's usually one digit lower than the VMID
  • /usr/lib/vmware/bin/vmkload_app -k 9 {Enter Master User World ID Here}
  • You should now be able to re-attach the VMX to an inventory.

Future-wise, consider a physical vCenter box. A virtual one still doesn't sit quite right with me.

Related Topic