Sometimes it happens that after powering off a virtual machine it does not shutdown completely and hangs at 95% or 98%. After keep waiting in hope that virtual machine will be powered off in sometime it doesn’t happen. Now here is 2 solutions which you can do to avoid such problems:

Solution-1

1. Enable SSH access on the ESX host that is hosting the problem VM.

2. Connect to the ESX host via SSH, and logon as root. Execute the following command to see all the running VMs on this host, and list their world ID numbers.

# esxcli vm process list

Image

3. Once you have the World ID of the problem VM, you can attempt to power it off with the following command;

Syntax

esxcli vm process kill –type {soft,hard,force} –world-id {ID Number}

Example

esxcli vm process kill –type hard –world-id  4290

4. Check now. Your VM should now be powered off.

Solution-2

1. Issue the following command to locate the Process ID’s that are associated with the problem VM.

Syntax

ps | grep “VM Name”

Example

ps | grep “Vcentre-1”

You will get all the processes, and they are preceded by two columns of numbers, the first column contains the individual PID’s. The second column is the PID for the parent process, this is the one you need.

Image

 
2. Armed with your PID, you need to terminate that parent process with the following command;

Syntax

kill {PID}

Example

kill 4289

Posted in: Vmware.
Last Modified: February 5, 2014

Leave a reply