Posted on August 19, 2015 · Posted in VMWare

VMware ESXi: How to Restart a Hung Virtual Machine

When working with VMWare vSphere virtual machines, a virtual machine can sometimes hang up and it’s impossible to stop or restart it from vSphere console. In these cases, the only way to turn off or restart a virtual machine is to reboot the whole ESXi server that is not always possible, especially when there is only one ESXi server, or the rest DRS cluster machines are not able to cope with the extra load of virtual machines from the server to be restarted. Then you can manually stop a frozen virtual machine using CLI. It can be done in several ways (vCLI, PowerCLI, etc.), but I will show how to do in the SSH console.

Firstly, SSH protocol has to be activated on your ESXi 5 server. You can do it from the vSphere interface. Select the necessary host (ESXi server) -> Configuration-> Security profile -> Properties -> SSH->Start, and connect to you ESXi server over SSH. Enable SSH on VMWare ESXi

In this example, we’ll stop the hung-up virtual machine using esxtop command.

In CLI, enter esxtop, press “C” to display CPU resources and then SHIFT+V to display only virtual machine processes.

esxtop on esxi

Then press “F” (to select fields to be displayed), “C” (to display LWID- Leader World Id) and then press ENTER.

vm's process

In the Name column, find the virtual machine to be stopped and note its LWID number in the corresponding column.

Now you have to press “K” (kill) and enter the LWID number of the virtual machine to be stopped. After the hard reset, the installed system will start in the Error Recovery mode. In guest Windows, it looks like as shown on the following screenshot.

Windows Error Recovery

Related Articles