MyException - 我的异常网
当前位置:我的异常网» 综合 » 解决打开VMware虚拟机时Take Ownership出错的有关问

解决打开VMware虚拟机时Take Ownership出错的有关问题

www.MyException.Cn  网友分享于:2013-02-21  浏览:11次
解决打开VMware虚拟机时Take Ownership出错的问题

问题描述:

试图打开一个虚拟机,VMware workstation弹出对话框(图1),选择“Take Ownership”后出错(图2)。



图1



图2


解决办法:

首先你需要确认虚拟机没有被其他VMware程序所使用,包括运行在另一个系统上的副本。若发现虚拟机正在被使用,那么你应该用正常的方式关闭那个实例。

注意:如出现图2所示情况,说明打开这个虚拟机的实例运行在本机,这时候有两种可能:

1. VMware Player或VMware workstation其中之一打开了这台虚拟机,解决办法自然是直接使用或关闭那个实例,这没什么好说的。反而是下面这种情况更常见!

2. 上次使用这台虚拟机的实例没有正常关闭,导致有旧的*.lck文件残留在系统中。对于这种情况,可以找到虚拟机所在目录,手动删除xxxx.vmx.lck文件夹(图3)或其中的*.lck文件。



图3


原理分析:

简单来说,VMware为了防止多个运行实例打开同一个虚拟机,引入了lock的机制,在打开虚拟机的时候,VMware会像虚拟机所在目录添加*.lck文件,以示该虚拟机正在被使用。这样如果有另一个VMware实例(可以不在同一台计算机上)试图打开这个虚拟机,该操作就会被拒绝,这样就可以防止多个实例同时修改一个磁盘文件(*.vmdk)所造成的错误。此外,*.lck文件中保存了两个最关键的信息,那就是打开这台虚拟机的宿主计算机(host computer)ID,还有打开它的VMware实例的进程ID(图4、图5)。



图4



图5


参考资料:

www.vmware.com | http://www.vmware.com/pdf/ws71_manual.pdf

Lock Files 

A running virtual machine creates lock files to prevent consistency problems on virtual disks. Without locks, multiple virtual machines might read and write to the disk, causing data corruption.

Lock files are created in subdirectories with a .lck suffix. The locking subdirectories reside in the same directory as the virtual machine’s .vmdk files. A locking subdirectory and lock file are created for .vmdk files, .vmx files, and .vmem files.

Since theWorkstation 6.0 release, a unified locking method is used on all host operating systems, so files shared between them are fully protected. For example, if one user on a Linux host tries to power on a virtual machine that is already powered on by another user with a Windows host, the lock files prevent the second user from powering on the virtual machine.

When a virtual machine powers off, itremoves the locking subdirectories and their lock files. If it cannot remove these locking controls, one or more stale lock files might
remain. For example, if the host machine fails before the virtual machine removes its locking controls, stale lock files remain.

When the virtual machine restarts, it scans any locking subdirectories for stale lock files and, when possible, removes them. A lock file is considered stale if both of the following conditions are true:

 The lock file was created on the same host that is now running the virtual machine.

 The process that created the lock is no longer running.

If either of these conditions is not true, a dialog box warns you that the virtual machine cannot be powered on. You can delete the locking directories and their lock files manually.

Locks also protect physical disk partitions. However, the host operating system is not aware of this locking convention and thus does not recognize it. For this reason,
VMware recommends that the physical disk for a virtual machine not be installed on the same physical disk as the host operating system.



文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有