Fix Orphaned VM

SOURCE: http://orphanedvms.blogspot.com/
http://www.yellow-bricks.com/2011/11/16/esxi-commandline-work/

CLI
-login to ESXi
list vms
-get VMID
#vim-cmd vmsvc/getallvms
-find orphan vm
#vim-cmd vmsvc/power.getstate
It give vmware-vpxa es the result as that “VMControl error -11: No such virtual machine”
Try restarting, mgmt-vmware & vmware-vpxa daemons from esx console.

From the Direct Console User Interface (DCUI):

Connect to the console of your ESXi host.
Press F2 to customize the system.
Log in as root.
Use the Up/Down arrows to navigate to Restart Management Agents.
Note: In ESXi 4.1 and ESXi 5.0, 5.1, 5.5 and 6.0 this option is available under Troubleshooting Options.
Press Enter.
Press F11 to restart the services.
When the service has been restarted, press Enter.
Press Esc to log out of the system.
From the Local Console or SSH:
Log in to SSH or Local console as root.
Run these commands:
#/etc/init.d/hostd restart
#/etc/init.d/vpxa restart

If still finding the orphan, unregister and re-register the VM from ESX console with following command.

Unregister:
#vim-cmd /vmsvc/unregister <Vmid>

Register:
#vim-cmd /vmsvc/register /path/to/file.vmx

Easiest method
GUI
-Launch Virtual Center or Virtual Client
-Right click on the orphaned virtual machine
-Select ‘Remove from Inventory’
-Now go the summary page of the ESX host and select correct datastore
-Browse the datastore form the .vmx file of the VM
-Now locate the VMX file.
-Right click on the .vmx file of the VM and choose ‘Add to Inventory’
-Go through the wizard and your Virtual Machine should appear online again
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s