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 VMware vSphere ESXi 6.0 VMware vSphere ESXi 7.0 VMware vSphere ESXi 8.0

Issue/Introduction

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
  • Error seen:

    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, entries seen are 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.

  • Errors seen that may indicate a corrupted descriptor file:

    YYYY-MM-DDTHH:MM:SS| vcpu-0| DISK: Cannot open disk "/vmfs/volumes/XXXXX-XXXXX-XXXXX-XXXXX/<vm-name>/<vm-name>-000003.vmdk": The capacity of the parent virtual disk and the capacity of the child disk are different (67).
    YYYY-MM-DDTHH:MM:SS| vcpu-0| Msg_Post: Error
    YYYY-MM-DDTHH:MM:SS| vcpu-0| [msg.disk.noBackEnd] Cannot open the disk '/vmfs/volumes/XXXXX-XXXXX-XXXXX-XXXXX/<vm-name>/<vm-name>-000003.vmdk' or one of the snapshot disks it depends on.
    YYYY-MM-DDTHH:MM:SS| vcpu-0| [msg.disk.configureDiskError] Reason: The capacity of the parent virtual disk and the capacity of the child disk are different.
    YYYY-MM-DDTHH:MM:SS| vcpu-0| ----------------------------------------
    YYYY-MM-DDTHH:MM:SS| vcpu-0| CPT current = 6, requesting 0
    YYYY-MM-DDTHH:MM:SS| vcpu-0| Msg_Post: Error
    YYYY-MM-DDTHH:MM:SS| 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 vSphere ESXi 6.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x

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:

    YYYY-MM-DDTHH:MM:SS cpu7:8715)FS3: 2928: [Requested mode: 2] Lock [type 10c00001 offset 11401216 v 2035, hb offset 3178496
    gen 26643, mode 1, owner XXXXX-XXXXX-XXXXX-XXXXX mtime 2213195] is not free on volume 'Datastore-Name'
  • The file may have been locked by third-party software running on an ESXi 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 ESXi hosts (broadcom.com)

For additional steps to try, see Failed to lock the file or One or more disks are busy deleting vm snapshots (broadcom.com)

Additional Information