Virtual machine powers off while creating or deleting snapshots with the error: Failed to lock the file
search cancel

Virtual machine powers off while creating or deleting snapshots with the error: Failed to lock the file

book

Article ID: 310768

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:
While creating or deleting snapshots, the virtual machine is abruptly powered off with these symptoms:

  • The create or delete snapshot task fails.
  • The virtual machine is powered off with the error
  • You see the error:

    Cannot open the disk '/vmfs/volumes/UUID/VMName/VMName-000001.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file.

  • In the vmware.log file, for the virtual machine contains messages similar to:

    vmx| [msg.disk.configureDiskError] Reason: Failed to lock the file.----------------------------------------
    vmx| Msg_Post: Error
    vmx| [msg.checkpoint.continuesync.fail] Error encountered while restarting virtual machine after taking snapshot. The virtual machine will be powered off.


  • The hostd.log file, you see entries similar to:

    info 'ha-eventmgr'] Event 78390 : Message on VMNAME on ESXHOSTNAME in ha-datacenter: Cannot open the disk '/vmfs/volumes/UUID/VMName/VMName-000001.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file.

  • When you have a corrupted descriptor file, you may see errors similar to:

    10T04:40:30.093Z| vcpu-0| DISK: Cannot open disk "/vmfs/volumes/4a96b658-f4566303-6459-0024e86324cf/<vm-name>/<vm-name>-000003.vmdk": The capacity of the parent virtual disk and the capacity of the child disk are different (67).
    10T04:40:30.093Z| vcpu-0| Msg_Post: Error
    10T04:40:30.093Z| vcpu-0| [msg.disk.noBackEnd] Cannot open the disk '/vmfs/volumes/4a96b658-f4566303-6459-0024e86324cf/<vm-name>/<vm-name>-000003.vmdk' or one of the snapshot disks it depends on.
    10T04:40:30.093Z| vcpu-0| [msg.disk.configureDiskError] Reason: The capacity of the parent virtual disk and the capacity of the child disk are different.
    10T04:40:30.093Z| vcpu-0| ----------------------------------------
    10T04:40:30.102Z| vcpu-0| CPT current = 6, requesting 0
    10T04:40:30.109Z| vcpu-0| Msg_Post: Error
    10T04:40:30.109Z| vcpu-0| [msg.checkpoint.continuesync.fail] An error occurred while restarting virtual machine after taking a snapshot. The virtual machine will be powered off.


Environment

VMware ESXi 4.1.x Installable
VMware ESXi 4.0.x Embedded
VMware ESX 4.0.x
VMware ESX Server 3.5.x
VMware ESXi 3.5.x Embedded
VMware vSphere ESXi 5.0
VMware ESX 4.1.x
VMware ESXi 4.0.x Installable
VMware vSphere ESXi 5.5
VMware vSphere ESXi 5.1
VMware vSphere ESXi 6.0
VMware ESX Server 3.0.x
VMware vSphere ESXi 6.5
VMware ESXi 4.1.x Embedded
VMware ESXi 3.5.x Installable
VMware vSphere ESXi 6.7

Cause

This issue occurs when one of the files required by the virtual machine has been opened by another application.

During a Create or Delete Snapshot operation while a virtual machine is running, all the disk files are momentarily closed and reopened. During this window, the files could be opened by another virtual machine, management process, or third-party utility. If that application creates and maintains a lock on the required disk files, the virtual machine cannot reopen the file and resume running.

Resolution

If the file is no longer locked, try to power on the virtual machine again. This should succeed. To determine the cause of the previously locked file, review the VMkernel, hostd, and vpxa log files and attempt to determine:
  • When the hostd and vpxa management agents open VMDK descriptor files, they log messages similar to:

    info 'DiskLib'] DISKLIB-VMFS : "/vmfs/volumes/UUID/VMName/VMName-000001.vmdk" : open successful (21) size = 32227695616, hd = 0. Type 8
    info 'DiskLib'] DISKLIB-VMFS : "/vmfs/volumes/UUID/VMName/VMName-000001.vmdk" : closed.


  • When the VMkernel attempts to open a locked file, it reports:

    31:16:46:55.498 cpu7:8715)FS3: 2928: [Requested mode: 2] Lock [type 10c00001 offset 11401216 v 2035, hb offset 3178496
    gen 26643, mode 1, owner 4ca72d14-84dc8dd4-0da3-0017a4770038 mtime 2213195] is not free on volume 'norr_prod_vmfs_data08'

  • The file may have been locked by third-party software running on an ESXi/ESX host or externally. Review the logs of any third-party software that may have acted on the virtual machine's VMDK files at the time.
If the virtual machine cannot be powered on again because the file remains locked, or to determine which ESX host held the lock previously, see Investigating virtual machine file locks on ESX/ESXi (10051).

For additional steps to try, see Unable to delete the virtual machine snapshot due to locked files (2017072).

Additional Information


Investigating virtual machine file locks on ESXi
VMware ESX 4.0, Patch ESX400-201105201-UG: Updates the VMware ESX 4.0 Core and CIM components
Unable to delete the virtual machine snapshots
在创建或删除快照时虚拟机电源关闭,并出现以下错误:无法锁定文件
スナップショットの作成または削除時に「Failed to lock the file」というエラーが表示されて仮想マシンがパワーオフされる
A máquina virtual desliga durante a criação ou a exclusão de instantâneos e apresenta o erro: falha ao bloquear o arquivo