2008-09-17 633 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"