The Real (and Virtual) Adventures of Nathan the IT Guy

Oct 27 2009   3:42PM GMT

How to Properly kill a VM



Posted by: Nathan Simon
Tags:
ESX Server 3.5
how to find the PID of a vm
kill -9 PID
PID
ps -ef |grep
ps auxfww | grep
vm won't respond
vmware
vmware-cmd
vmware-cmd stop
vmware-cmd stop hard
vmx
vsphere

We all know that you can use the command “ps -ef |grep (vmconfig filename.vmx)” to find the PID for a VM, but I get confused as to which number that comes up is actually the PID… I found a new command that works much better. See below.

The Definitive way to Kill a PID process

The steps below are based on the fact that you already tried to use “vmware-cmd vmname.vmx stop; stop hard”

1.)    A final solution is to kill the PID (process ID). Issue the following command: “ps auxfww | grep <vmname>” to locate the correct PID (BTW: this cannot be done via *ESXTOP*). The first number to appear in the output is your PID. The PID can be used to terminate the process by issuing kill -9 PID.

2.)    Run vmware-cmd <vmname>.vmx getstate to see if it is now “off”, as it should be.

3.)    You can now go back into Virtual Infrastructure Client and start the machine.

-NS

1  Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Nathan Simon
    I learnt something today... if you type "[B]ps auxfww | grep [/B]" you will end your session, and not neccissarliy the vm process id. the right command is "[B]ps auxfww | grep &[/B]" this will execute the command in the background and report when its done.
    700 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: