【问题标题】:How do I kill a VMware virtual machine that won't die? [closed]如何杀死不会死的VMware虚拟机? [关闭]
【发布时间】:2010-09-10 01:14:01
【问题描述】:

我在服务器上运行了一个无法停止或重新启动的虚拟机 - 我无法再登录它,也无法使用 VMware 服务器控制台停止它。还有其他 VM 正在运行,因此重新启动主机是不可能的。有没有其他方法可以强制一台机器停止?

【问题讨论】:

    标签: vmware


    【解决方案1】:

    如果您使用的是 linux,那么您可以使用

    获取来宾进程
    ps axuw | grep vmware-vmx
    

    正如@Dubas 指出的那样,您应该能够通过 VMD 的路径名找出错误进程

    【讨论】:

    • 太棒了。使用此命令,您可以查看机器的路径以轻松选择正确的 PID。
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

      在某些情况下,您可能无法暂停虚拟机,或者就此而言无法对虚拟机执行任何“电源”操作。您可能还已经启动并运行了多个 VM。使用此过程来识别要杀死的正确 PID。

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

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

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

      【讨论】:

        【解决方案4】:

        这是我根据

        所做的

        a) @Espo 的 cmets 和
        b) 事实上我只有 Windows 任务管理器可以玩......

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

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

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

        当我恢复它时,我可以识别与我的机器对应的 vmware-vmx 进程并可以杀死它。

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

        【讨论】:

        • 不会有任何不良影响。 VMWare 为每个 VM 分别处理进程。事实上,它也分别处理 VM Engine 和 VM Graphics。所以你的图形可能会崩溃,但你的虚拟机会继续工作。
        • 很高兴看到它有所帮助。如果您使用过 Process Explorer,您可能会看到窗口标题和磁盘文件的名称,这将节省您的输入。 (现在谁在使用 Pen&Paper?:))
        【解决方案5】:

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

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

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

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

        【讨论】:

          【解决方案6】:

          对于 ESXi 5,您首先需要通过 vSphere 控制台启用 ssh,然后登录并使用以下命令查找进程 ID

          ps -c | grep -i "machine name"
          

          然后您可以找到进程 ID 并使用 kill 结束进程

          【讨论】:

            【解决方案7】:

            从 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"
            

            【讨论】:

              【解决方案8】:

              对于 VmWare fusion,按住 alt 键的同时单击“重新启动虚拟机”

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

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 2014-09-25
                • 1970-01-01
                • 2013-07-03
                • 1970-01-01
                • 1970-01-01
                • 2010-09-08
                • 2016-01-24
                • 2015-08-09
                相关资源
                最近更新 更多