2008-09-17 151 views
21

我有一台虚拟机在服务器上运行,我无法停止或重新启动 - 我无法再登录,并且无法使用VMware服务器控制台停止它。还有其他虚拟机正在运行,因此重新启动主机是不可能的。有没有其他办法强制一台机器停下来?如何杀死一个不会死的VMware虚拟机?

回答

13

如果您使用的是Windows,那么虚拟机应该有它自己的进程,该进程在任务管理器中可见。使用sysinternals Process Explorer找到正确的,然后从那里杀死它。

13

如果你是在Linux上,那么你可以抓住客人的过程与

ps axuw | grep vmware-vmx 

由于@Dubas指出的那样,你应该能够通过的路径名挑出来的错误的过程中对VMD

+2

大。使用此命令,您可以查看机器的路径以轻松选择正确的PID。 – Dubas 2011-03-01 10:29:54

3

这里是我基于

什么

一)@Espo的意见和
b)的事实,我只用了Windows任务管理器....

我登录到主机,打开任务管理器并使用视图菜单将PID列添加到进程选项卡。

我在包装盒上运行的每个vmware-wmx.exe进程的每个实例都记下了(是,用纸和笔)PID。

使用VMWare控制台,我暂停了错误的虚拟机。

当我恢复它时,我可以识别出与我的机器相对应的vmware-vmx进程,并且可以终止它。

到目前为止似乎没有任何不良影响。

+1

不会有任何不良影响。 VMWare分别为每个VM处理进程。实际上,它也分别处理VM引擎和VM Graphics。所以你的图形可能会崩溃,但你的虚拟机将继续工作。 – 2008-09-17 11:00:39

3

类似,但使用WMIC命令行来获得进程ID和路径:

WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid 

这将创建与每个进程及其参数的文本文件。您可以在文件中搜索您的虚拟机文件路径,并获取正确的进程ID以结束任务。

感谢http://windowsxp.mvps.org/listproc.htm了解正确的命令行参数。

2

对于ESXi 5,你首先要通过的vSphere控制台启用SSH,然后登录并使用下面的命令来查找进程ID

ps -c | grep -i "machine name" 

然后,您可以找到进程ID和结束使用的流程kill

4

在某些情况下,您可能无法挂起,或者因此无法在VM上执行任何“电源”操作。您可能已经有多个VM正在运行。使用此过程来确定要杀死的正确PID。

在Windows 7上 - 打开任务管理器 - 查找名称为“vmware-vmx.exe”的进程,注意PID。

切换到性能选项卡并启动“资源监视器”。展开“磁盘活动”面板。对“文件”列进行排序。为要杀死的虚拟机查找适当的vmdk文件。“Image”列将列出“vmware-vmx”进程。注意PID。

切换回“进程”选项卡并终止PID。

1

看到VMware的网页

以下的ESXi主机上关闭受虚拟机(1014165) 症状

您遇到这些问题:

You cannot power off an ESXi hosted virtual machine. 
A virtual machine is not responsive and cannot be stopped or killed. 

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1014165

“使用的ESXi 5.x esxcli命令虚拟机

esxcli命令可以本地或远程地用于在ESXi 5运行的虚拟机关闭电源关闭电源。 X。有关更多信息,请参见“vSphere命令行界面参考”中的“esxcli vm命令”部分。

Open a console session where the esxcli tool is available, either in the ESXi Shell, the vSphere Management Assistant (vMA), or the location where the vSphere Command-Line Interface (vCLI) is installed. 

Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file, using this command: 

esxcli vm process list 

Power off one of the virtual machines from the list using this command: 

esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber 

Notes: 
Three power-off methods are available. Soft is the most graceful, hard performs an immediate shutdown, and force should be used as a last resort. 
Alternate power off command syntax is: esxcli vm process kill -t [soft,hard,force] -w WorldNumber 

Repeat Step 2 and validate that the virtual machine is no longer running. 

对于ESXi 4.1:

Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file, using this command: 

esxcli vms vm list 

Power off one of the virtual machines from the list using this command: 

esxcli vms vm kill --type=[soft,hard,force] --world-id=WorldNumber"