We’d virtualize the whole world if we could…
Posted on | January 16, 2009 | No Comments
So here at Crowd Rent we’re big fans of virtualization. We use it for everything! We’d virtualize anything we could because it makes life so much easier. We use VMware’s ESX Server running on Dell AX150 fiber and MD3000i iSCSI SANs. Now from time to time we lose a VM but ESX thinks it’s still running. A quick look at ESX top shows nothing for that VM. Typically running ps waux and grep’ing the results would give you a folder name in the process to kill. Use a little kill -9 PID would take care of it. However, I couldn’t find the directory name in the ps command. Oh boy…
So between Google and the VMware forums I found some enterprising ESX/Linux geniuses who whipped this little gem up:
ps a --cols=750 -C vmkload_app | grep [.]vmx |
awk {'print"PID=" $1 " VM="$NF'}|sed 's|/vmfs/.*/||'
Through the magic of Linux they dumpped the output into a script to parse it and give the following:
PID=2889 VM=Benson.vmx PID=10868 VM=SugarCreek.vmx PID=26281 VM=SanGabriel.vmx PID=26238 VM=Bisbee.vmx PID=7917 VM=AshFork.vmx PID=9186 VM=Otay.vmx PID=9189 VM=Fresno.vmx PID=12993 VM=Avondale.vmx
Guess what the “PID” is? It’s the process ID. Killed the one I wanted, restarted the management console, and reregistered the VM from the console and started it. I could have literally done it from my BlackBerry. Score one (more) for Linux and VMware.
Tags: general geeky goodness > Linux > software > Virtualization > VMware
Comments
Leave a Reply