Archive for November, 2008

Stopping a stuck VM from the command line:

Wednesday, November 12th, 2008

I don’t think servers should ever need to be rebooted.  I have a cluster set up with VMotion, but I just don’t like the idea that I need to reboot the server to stop one VM.  That’s why I got so frustrated when one of my VM’s got a repeating message saying the redo log was corrupt.  Every time I clicked OK, I got the same message.  Normally I would need to reboot the host and remove the redo logs.  Here is a better way I found on a blog:
1. Log into your box and find the VM.
#cat /proc/vmware/vm/*/names

2. Your VM will have a 4 digit number.  Then, find the ID to kill (replace 1111 with your number):
# less /proc/vmware/vm/1111/cpu/status

3. Under “group” find the vm.2222. Then type this command to kill the machine:

/usr/lib/vmware/bin/vmkload_app -k 9 2222

=========

For ESX 4:

  1. List all running virtual machines to find the vmxCartelID of the affected virtual machine with the command:

    # /usr/lib/vmware/bin/vmdumper -l

  2. Scroll through the list until you see your virtual machine’s name. The output appears similar to:

    vmid=5151       pid=-1  cfgFile=”/vmfs/volumes/4a16a48a-d807aa7e-e674-001e4ffc52e9/mdineeen_test/vm_test.vmx”  uuid=”56 4d a6 db 0a e2 e5 3e-a9 2b 31 4b 69 29 15 19″  displayName=”vm_test”  vmxCartelID=####

  3. Run the following command to shut the virtual machine down with the vmxCartelID:

    # /usr/lib/vmware/bin/vmkload_app -k 9 ####