VMware虚拟机运行时出错:cannot open the disk xxxxxxxxxxx.vmdk. failed to lock the file

在windows下运行linux中创建的虚拟机时出错,无法运行。
错误提示大概为:
cannot open the disk xxxxxxxx.vmdk or one of the snapshot disks itdepends on.
reason: failed to lock the file.

网上中文帖子里面教的方法都是废的。

国外网友很简单:把虚拟机文件夹里【.lck】后缀的文件/文件夹删除即可。


方法1(转自:http://blog.chinaunix.net/uid-24250828-id-3012727.html )


打开VMware出现Cannot open the disk *.vmdk or one of the snapshot disks it depends on.Reason: Failed to lock the file.错误的解决办法!

   今天我公司做的虚拟化服务器出现故障意外重启了,主系统启动之后,在启动VMware虚拟机的时候出现了Cannot open the disk '*.vmdk' or one of the snapshot disks it depends on.Reason: Failed to lock the file.的错误,一个虚拟机无法启动将影响到很多用户的使用,所以我马上开始寻找解决Reason: Failed to lock the file的办法!于是我到百度搜索了一下这个错误的具体原因,搜索结果中给出了两种解决办法!

解决办法一:
   1、在VMware该虚拟机路径下的所有.lck文件和文件夹下删除或迁移至其它目录,一般就可以解决了。
   2、如果再次启动VMware的Windows Vista系统失败,尝试右键虚拟机出错的系统->Settings->Hardware->Hard Disk->Utilities->Map->映射虚拟硬盘到Z:/
   3、断开虚拟硬盘,重新加载,启动。系统就可以正常启动了

经实验此办法以失败结 束。如果有遇到Cannot open the disk '*.vmdk' or one of the snapshot disks it depends on.Reason: Failed to lock the file错误的朋友不妨也试一下。如果您实验成功了,请给我们留言,以便我们进行更好的技术交流

解决办法二:

   使用记事本打开*.VMX文件上加上一行代码disk.locking = "FALSE",重新启动该虚拟机。

使用方法二,问题得到 解决,重新启动VMware正常启动,不会再出现Cannot open the disk '*.vmdk' or one of the snapshot disks it depends on.Reason: Failed to lock the file.错误。

希望各位从事虚拟化的朋友能有所帮助,也欢迎各位来我站踊跃投稿!

方法2(转自: http://www.ardamis.com/2009/11/20/vmware-cannot-open-the-disk-xxxxxx-vmdk-or-one-of-the-snapshot-disks-it-depends-on/ )

VMware “Cannot open the disk ‘XXXXXX.vmdk’ or one of the snapshot disks it depends on.”

From time to time, I want to copy just the minimum files for a VMware virtual machine: the two .vmdk files and the .vmx file. After moving those files to a new location or deleting a snapshot file, attempting to boot the virtual machine returns the following error message:

Cannot open the disk ‘XXXXXX.vmdk’ or one of the snapshot disks it depends on.
Reason: The system cannot find the file specified.

I’ve found that following the steps below fixes the problem and allows me to boot the virtual machine as it existed at the time of creation. DO NOT USE these steps if you need to retain any changes to the machine:

Open the *.vmx file in a text editor and find the line that refers to the old snapshot file, which will look something like:
scsi0:0.fileName = “XXXXXX-000002.vmdk”
or
ide0:0.fileName = “XXXXXX-000002.vmdk”

Change the value to the filename of the ~1kb .vmdk file (which happens to be the same as the name of the VM). For example, if your virtual machine was named “Windows XP Professional”, the line would read:

scsi0:0.fileName = “Windows XP Professional.vmdk”

Power on the VM. It should boot normally, but because the snapshot file is missing, the machine will boot to an earlier state.


### VMware 17 虚拟机启动失败的原因及解决方案 #### 锁定文件失败或磁盘错误 当遇到类似于“锁定文件失败 打不开磁盘'E:\BaiduNetdiskDownload\UBUNTU16.04虚拟机\Ubuntu\Ubuntu 64位.vmdk' 或它所依赖的某个快照磁盘模块 'Disk' 启动失败”的情况,这通常意味着存在磁盘访问权限或者路径配置方面的问题[^2]。 对于此类问题建议: - **确认磁盘文件位置**:确保指定的 `.vmdk` 文件确实存在于给定的位置,并且没有被移动过。 - **检查读写权限**:验证当前用户账户拥有足够的权限来读取和修改该磁盘映像文件及其所在目录下的其他资源。 - **关闭占用程序**:如果有任何应用程序正在使用此虚拟硬盘,则尝试终止这些进程后再重试。 如果上述措施仍无法解决问题,可能是因为虚拟磁盘本身损坏了。此可以考虑利用 `vmware-vdiskmanager.exe` 工具来进行修复操作,具体命令如下所示: ```bash "C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe" -R "E:\path_to_your_disk_file.vmdk" ``` #### 进入救援模式处理分区问题 针对因意外断电等原因造成的启动失败并进入救援模式的情况,在救援界面中会指出具体的受损分区名称(例如 dm-0)。这可以通过卸载受影响的设备节点再对其进行修复的方式恢复系统正常运行状态[^4]。 执行以下 Linux 命令序列完成修复过程: ```bash umount /dev/dm-0 xfs_repair -L /dev/dm-0 reboot ``` 请注意以上指令适用于采用 XFS 文件系统的场景;如果是 ext4 等其它类型的文件系统则需替换相应的工具集。 #### 配置网络适配器设置 有即使解决了硬件层面的问题之后仍然会出现无法联网的现象。这候应该查看一下虚拟网卡的状态以及其对应的物理主机上的网络接口是否工作正常[^3]。 调整虚拟机内部的操作系统中的 IP 地址分配方式为 DHCP 自动获取,并重启服务使更改生效: ```bash nmcli con modify eth0 ipv4.method auto systemctl restart NetworkManager.service ``` 通过采取上述针对性的方法能够有效应对大多数常见的 VMware 17 版本下虚拟机不能顺利开机的情形。不过考虑到不同环境之间可能存在差异性因素影响最终效果,请根据实际情况灵活运用所提供的指导方针。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值