Error: "Failed to lock the file" occurs during snapshot creation after manual VM migration from Azure - vSphere ESXi
search cancel

Error: "Failed to lock the file" occurs during snapshot creation after manual VM migration from Azure - vSphere ESXi

book

Article ID: 443055

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

  • When attempting to take a snapshot of a virtual machine, the task fails with the following errors:

    Hostd[2098950]: [Originator@6876 sub=Vigor.Vmsvc.vm:/vmfs/volumes/<Datastore UUID>/<VM Name>/<VM Name>.vmx] Create Snapshot translated error to vim.fault.FileLocked
    Hostd[2098950]: [Originator@6876 sub=Vigor.Vmsvc.vm:/vmfs/volumes/<Datastore UUID>/<VM Name>/<VM Name>.vmx] Create Snapshot message: An error occurred while saving the snapshot: Failed to lock the file.
    Hostd[2098930]: --> An error occurred while taking a snapshot: Failed to lock the file.

  • After following the steps described in KB Investigating Virtual Machine file locks on ESXi Host(s) to determine who was locking this file, only the virtual machine in question was identified.

Cause

This issue occurs when virtual machine disk files (.vmdk) are uploaded to an ESXi host using an unsupported manual procedure (e.g., via the Datastore Browser/Host Client UI) without proper conversion. 

In many cases, the source disks (exported from Azure, VMware Workstation, or other hosted platforms) use a 'hosted' disk format (such as `monolithicSparse` or 'twoGbMaxExtentSparse'). When these are manually moved, the ESXi host cannot natively manage the file locks required for snapshot operations and causes descriptor corruption or I/O compatibility errors.

  • To verify the disk format, run 'cat <VM Name>.vmdk' or 'hexdump -C <VM Name>.vmdk' and locate createType:

    $ cat <VM Name>.vmdk
    ...
    # Disk DescriptorFile
    version=1
    CID=########
    parentCID=ffffffff
    createType="monolithicSparse"
    ...

    $ hexdump -C  <VM Name>.vmdk
    ...
    00000200  23 20 44 69 73 6b 20 44  65 73 63 72 69 70 74 6f  |# Disk Descripto|
    00000210  72 46 69 6c 65 0a 76 65  72 73 69 6f 6e 3d 31 0a  |rFile.version=1.|
    00000220  43 49 44 3d ## ## ## ##  ## ## ## ## 0a 70 61 72  |CID=########.par|
    00000230  65 6e 74 43 49 44 3d 66  66 66 66 66 66 66 66 0a  |entCID=ffffffff.|
    00000240  63 72 65 61 74 65 54 79  70 65 3d 22 6d 6f 6e 6f  |createType="mono|
    00000250  6c 69 74 68 69 63 53 70  61 72 73 65 22 0a 0a 23  |lithicSparse"..#|
    ...

 

  • After uploading the vmdk file, `Object type requires hosted I/O` error can be seen in the hostd log:

    Hostd[#######]: [Originator@#### sub=DiskLib opID=esxui-####-#### sid=######## user=root] DISKLIB-LINK  : DiskLinkOpen: Failed to open '/vmfs/volumes/<Datastore UUID>/<VM Name>/<VM Name>.vmdk': : Object type requires hosted I/O
    Hostd[#######]: [Originator@#### sub=DiskLib opID=esxui-####-#### sid=######## user=root] DISKLIB-CHAIN : DiskChainOpen: "/vmfs/volumes/<Datastore UUID>/<VM Name>/<VM Name>.vmdk": failed to open: Object type requires hosted I/O.

Resolution

Migrate the VM using one of the following methods:

  • Import the VM via OVF/OVA or a supported migration tool

  • Convert the incompatible disk format to a native ESXi VMFS format using the `vmkfstools` utility.

Cloning and converting virtual machine disks with vmkfstools

Additional Information

VM power on fails with "Cannot open the disk" "one of the snapshot disks it depends on" due to incompatible disk type