Symptoms:
免責事項:これは英文の記事「Investigating virtual machine file locks on ESXi hosts」の日本語訳です。記事はベストエフォートで翻訳を進めているため、ローカライズ化コンテンツは最新情報ではない可能性があります。最新情報は英語版の記事で参照してください。
Failed to add disk scsi0:1. Failed to power on scsi0:1
Unable to open Swap File
Unable to access a file since it is locked
Unable to access a file <filename> since it is locked
Unable to access Virtual machine configuration
/var/log/vmkernel
ログ ファイルに、次のようなエントリが表示される。WARNING: World: VM xxxx: xxx: Failed to open swap file <path>: Lock was not free
WARNING: World: VM xxxx: xxx: Failed to initialize swap file <path>
Error connecting to <path><virtual machine>.vmx because the VMX is not started
cat or
vi
などの)テキスト エディタを使用して .vmx
ファイルを表示するか開くと、次のようなエラーが報告される。cat: can't open '[name of vm].vmx': Invalid argument
To prevent simultaneous changes to critical virtual machines and file systems, the ESXi/ESX host places locks on these files. In certain circumstances, these locks may not be released when the virtual machine is powered off. While the lock remains, the server cannot access the files and the virtual machine cannot be powered on.
The following virtual machine files become locked when they are running:
VMNAME.vswp
DISKNAME-flat.vmdk
DISKNAME-ITERATION-delta.vmdk
VMNAME.vmx
VMNAME.vmxf
vmware.log
Run Example
vmfsfilelockinfo -p /vmfs/volumes/iscsi-lefthand-2/VM1/VM1_1-000001-delta.vmdk -v 192.168.1.10 -u [email protected]
vmfsflelockinfo Version 1.0
Looking for lock owners on "VM1_1-000001-delta.vmdk"
"VM1_1-000001-delta.vmdk" is locked in Exclusive mode by host having mac address ['xx:xx:xx:xx:xx:xx']
Trying to make use of Fault Domain Manager
----------------------------------------------------------------------
Found 0 ESX hosts using Fault Domain Manager.
----------------------------------------------------------------------
Could not get information from Fault domain manager
Connecting to 192.168.1.10 with user [email protected]
Password: xXxXxXxXxXx
----------------------------------------------------------------------
Found 3 ESX hosts from Virtual Center Server.
----------------------------------------------------------------------
Searching on Host 192.168.1.178
Searching on Host 192.168.1.179
Searching on Host 192.168.1.180
MAC Address : xx:xx:xx:xx:xx:xx
Host owning the lock on the vmdk is 192.168.1.180, lockMode : Exclusive
Total time taken : 0.27 seconds.
注: 仮想マシンのライフサイクルの中で、いくつかのファイルはロックの状態が遷移します。lock state mode はファイルのロックの種類を示します。
Run Example
lsof | egrep 'Cartel|VM1_1-000001-delta.vmdk'
Cartel | World name | Type | fd | Description
36202 vmx FILE 80 /vmfs/volumes/556ce175-7f7bed3f-eb72-000c2998c47d/VM1/VM1_1-000001-delta.vmdk
The Cartel ID holding the lock is 36202.
esxcli vm process listThe
output will be as follows:
Alternate_VM27
World ID: 36205
Process ID: 0
VMX Cartel ID: 36202
UUID: 56 4d bd a1 1d 10 98 0f-c1 41 85 ea a9 dc 9f bf
Display Name: Alternate_VM27
Config File: /vmfs/volumes/556ce175-7f7bed3f-eb72-000c2998c47d/Alternate_VM27/Alternate_VM27.vmx
………
In the above example, the virtual machine with "VMX Cartel ID: 36202"
holds the lock on VM1_1-000001-delta.vmdk, and the virtual machine is Alternate_VM27.
for i in $(vim-cmd vmsvc/getallvms | grep -v Vmid | awk -F "/" '{print $2}' | awk '{print $1}'); do echo $i && find ./ -iname $i | xargs grep vmdk | grep -Ei VMDKS_TO_LOOK_FOR ; done
Create a directory "bkup" in the VM folder using the command "mkdir bkup" .
Move the lock file " lck- #### " using "mv lck-#### bkup" command .
「
Navigate to the "bkup" folder and make sure it's in the file list.ls -lah bkup
」コマンドを使用してファイルが
Note : VMFS volumes do not have lck files. The locking mechanism for VMFS volumes is handled within the VMFS metadata on the volume.
For more information on checking the integrity of virtual machine configuration files, see Verifying ESX/ESXi virtual machine file integrity
. Related information:
Note: If a lock is acquired during the switch period between the initial snapshot disk and the base disk, the VM may shut down after consolidation. For more information, seeVirtual Machine shuts down after a disk consolidation due to a locked file