Locate and remediate CID/parentCID mismatches in snapshot descriptor files using a scripted method.
search cancel

Locate and remediate CID/parentCID mismatches in snapshot descriptor files using a scripted method.

book

Article ID: 368913

calendar_today

Updated On:

Products

VMware vCenter Server 7.0 VMware vCenter Server 8.0 VMware vSphere ESXi 7.0 VMware vSphere ESXi 8.0

Issue/Introduction

  • The virtual machine is currently running on existing snapshot(s).
  • The VM cannot be powered on.
  • Snapshot consolidation is not possible.
  • Creating a new snapshot fails.

Attempts to power on the VM, consolidate snapshots, or create new snapshots fail with errors similar to the following in the vSphere Client:

Operation failed!
Task name Power On virtual machine
Target example_VM
Status File system specific implementation of Ioctl[file] failed
The parent virtual disk has been modified since the child was created. The content ID of the parent virtual disk does not match the corresponding parent content ID in the child
Unable to enumerate all disks. A required file was not found
An error occurred while deleting a snapshot: A required file was not found.
  • In vCenter tasks, snapshot consolidate failure reports below :
    • Task nameRevert snapshot
      Targetexample VM
      StatusDetected an invalid snapshot configuration.
    • Task nameCreate virtual machine snapshot
      Targetexample VM
      StatusAn error occurred while taking a snapshot: The parent of this virtual disk could not be opened.


  • On the ESXi host where the VM is registered, the hostd log (/var/run/log/hostd.log) records errors such as:
--> The parent virtual disk has been modified since the child was created. The content ID of the parent virtual disk does not match the corresponding parent content ID in the child
--> Cannot open the disk '/vmfs/volumes/example_VM/example_VM-000005.vmdk' or one of the snapshot disks it depends on.
--> Module 'Disk' power on failed.
--> Failed to start the virtual machine.

or:

-->OBJLIB-FILEBE : FileBEOpen: can't open '/vmfs/volumes/example_VM/example VM/example_VM-000005.vmdk' : Could not find the file 
-->DISKLIB-DSCPTR: DescriptorOpenInt: failed to open '/vmfs/volumes/example_VM/example VM/example_VM-000005.vmdk' with flags 0x400001: Could not find the file
-->DISKLIB-DSCPTR: DescriptorOpen: Failed to open: The system cannot find the file specified
-->DISKLIB-LINK  : DiskLinkOpen: Failed to open '/vmfs/volumes/example_VM/example VM/example_VM-000005.vmdk' : : The system cannot find the file specified
-->DISKLIB-CHAIN : DiskChainOpen: "/vmfs/volumes/example_VM/example VM/example_VM-000005.vmdk": Failed to o
pen parent "/vmfs/volumes/example_VM/example VM/example_VM-000004.vmdk": The system cannot find the file specified
-->DISKLIB-CHAIN : DiskChainOpen: "/vmfs/volumes/example_VM/example VM/example_VM-000005.vmdk": failed to open: The parent of this virtual disk could not be opened.
-->Event 353 : Failed to revert the execution state of the virtual machine example_VM on host esxi01.example.com, in compute resource esxi01.example.com to snapshot VM Snapshot DD/MM/YYYY, 10:58:03 PM, with ID 3
  • When attempting to power on the VM from vCenter Server, the vpxd log (/var/log/vmware/vpxd/vpxd.log) may display entries similar to the following:
    --> ERROR task-2115 --  -- example VM -- Drm.ExecuteVmPowerOnLRO: :vim.fault.GenericVmConfigFault
    --> Result:
    --> (vim.fault.GenericVmConfigFault) {
    -->    faultCause = (vmodl.MethodFault) null,
    -->    faultMessage = (vmodl.LocalizableMessage) [
    -->       (vmodl.LocalizableMessage) {
    -->          key = "msg.vigor.getAllDisk.error",
    -->          arg = <unset>,
    -->          message = "Unable to enumerate all disks."
    -->       },
    -->       (vmodl.LocalizableMessage) {
    -->          key = "msg.snapshot.error-NOTFOUND",
    -->          arg = <unset>,
    -->          message = "A required file was not found"
    -->       }
    -->    ],
    -->    reason = "Unable to enumerate all disks."
    -->    msg = "Unable to enumerate all disks."


Environment

VMware vSphere ESXi 8.x
VMware vSphere ESXi 7.x

Cause

This issue arises when there is a CID/parentCID mismatch within the virtual machine disk (VMDK) snapshot chain. In a healthy snapshot hierarchy, each snapshot descriptor file contains a unique Content ID (CID), and the subsequent snapshot points back to it through the parentCID field. If these identifiers do not align correctly—due to corruption, incomplete snapshot operations, or manual file manipulation—the snapshot chain becomes inconsistent.

When this mismatch occurs, the virtual machine may fail to power on, snapshots cannot be consolidated, and creating new snapshots may result in errors. Essentially, the VM is unable to determine the correct parent-child relationship between its disk and snapshot files, leading to operational failures until the chain is repaired.

Resolution

Note: There are some corner cases where this script may give a false positive result. For example, if there is a vmdk descriptor file that does not belong to the affected virtual machine in the same directory as the affected virtual machines disk descriptor files. Something like this would be unusual but it is highly recommended that you do a "dry run" of the script first i.e do not select the fix option take note of any VMDK discrepancies the script detects and take manual steps to address them. 
 

To understand the workings of this script then some knowledge of the snapshot process can be beneficial:

Overview of virtual machine snapshots in vSphere

Best practices for using VMware snapshots in the vSphere environment


1. STEPS TO USE THE SCRIPT

  • Use copy/paste to copy the attached "snapshot_chain_script.sh" script to the ESXi host the VM is registered on using VI editor or use a utility like WinSCP to copy the attached "snapshot_chain_script.sh" script to a directory of your choice on the ESXi host that the affected virtual machine is registered on.
    Download WinSCP
    Toggling the vCenter Server Appliance default shell

  • Once the script has been copied to the ESXi host run a chmod command to make it executable (For this example, the script is located in the /tmp directory)
    chmod +x /tmp/snapshot_chain_script.sh

  • Execute the script with the following command (For this example, the script is being executed from the /tmp directory):
    /tmp/snapshot_chain_script.sh

  • When the script runs you will be presented with a list of running/registered virtual machines on the ESXi host and a small menu:



  • There are 3 different ways to select the Virtual Machine to run the script against:

    1. Default Mode (Recommended):
       Enter the number corresponding to the VM. This allows you to select a VM from the list of VMs registered on the ESXi host. Once you enter the number and press Enter, the script will automatically identify the VMDK directories based on the associated VMX file. This mode is sufficient for most cases.

    2. VMX Path Mode:
       To use this option, enter 0 (zero) and press Enter. The script will then prompt you to manually provide the path to the VMX file. It will use the specified VMX file to determine the related VMDK directories. This mode is useful if the VM is not registered on any ESXi host.

    3. Manual Mode:
       To enter this mode, type 00 (double zero) and press Enter. The script will then run directly in the current working directory. Use this mode if the VM is not registered on any ESXi host and/or the VMDKs are not referenced in a VMX file. In this case, the script must be executed from within the directory that contains the VMDKs you want it to process. 

  • Regardless of which of the three options you use to select the VMDK directories, the subsequent process remains the same. The script will iterate through each VMDK descriptor file in the directory (with directories derived from the VMX file, except when running in Manual Mode) and verify their CID/parentCID consistency.

    Example of the script running and comparing CIDs/parentCIDs of VMDKs:



    In the example above, the VM was selected using the default option (by pressing 1 and choosing exampleVM). The script then executed and compared the CID/parentCID values in the VM’s snapshot descriptor (VMDK) files. This output is purely informational and can be safely ignored.

  • If no VM snapshot descriptor (VMDK) files are detected, then the script will display the following:



    If the selected VM is not running on snapshots, or if no VMDKs are found in the directory (which itself could indicate a potential issue if the VM is expected to be running from snapshots), then this output is considered normal. After proceeding, the script will return to the main menu, allowing you to select another VM if needed.
    In Manual Mode, however, the script will exit instead of returning to the menu. If further checks are required, it can be re-executed from a different directory.

  • If a CID/parentCID discrepancy has been detected, then the following screen is displayed:



    In the example above, the CID in exampleVM-000004.vmdk (fffffffe) does not match the parentCID in exampleVM-000005.vmdk (ffcffffe). This indicates a CID/parentCID mismatch that needs to be corrected.

    At this stage, you have two options:

    • Select 'y' to attempt an immediate repair.

    • Select 'n' to perform a dry run, which is the recommended approach. In this mode, the script will continue execution, report any detected discrepancies, and allow you to manually review and investigate them before rerunning the script to repair the snapshot chain if necessary.

  • If you choose to repair the mismatch, then the following screen is displayed:



    In the example above, the parentCID in exampleVM-000005.vmdk was changed from ffcffffe to fffffffe. The vmdk file is also backed up prior to modification and the path to the backup file is printed on screen. The script will continue comparing the CIDs/parentCIDs of other vmdks (if applicable) when the change is acknowledged. 

Another possible cause of the symptoms or errors described in this KB is a missing or renamed VMDK file. The script relies on the “parentFileNameHint” value within the VMDK files in a directory to validate the snapshot chain. If a mismatch is detected between the parentFileNameHint in a VMDK descriptor and the actual name of the parent VMDK file, the script will generate the following error:



In the example above, the script has identified a missing VMDK file. The script is only able to detect this issue, it cannot automatically resolve it. To address the problem, refer to the KB article mentioned in the error message. Once the issue has been corrected, you can re-run the script to perform another scan for CID/parentCID mismatches.

Once the script finishes, it will return to the main menu. If no prompts or warnings appear for missing VMDKs or mismatched CIDs/parentCIDs, it means the script did not detect any issues.

Additional Information

Important Notes and Limitations

  • The script only validates CID/parentCID consistency. It cannot recreate missing VMDK descriptor files.

  • VMs or paths containing spaces in their names have been tested successfully.

  • VMs with certain special characters in their names (e.g., * , ! , $ , ") are not supported, as these characters may be misinterpreted by bash.

  • Any VMDKs modified by the script are automatically backed up. The backup path will be displayed on screen—make sure to note it down.

  • Watch for invalid CIDs/parentCIDs. A valid identifier should be alphanumeric and exactly 8 characters long. The script does not verify this rare condition.

  • Outside of Manual Mode, the script uses the VMX file to identify the VMDK directories. It then scans all VMDK files within those directories and compares their CID/parentCID values. In rare cases (e.g., a stale VMDK left behind from a failed backup or snapshot consolidation), this may result in a false positive.

  • The script has been tested on a VM with four disks across four datastores, each having a snapshot chain six levels deep. However, it has not been tested at larger scale.

  • The script relies heavily on locating VMDKs via the VMX file. If there are snapshot disks not attached to the VM, you should run the script in Manual Mode.

  • The script has not been tested on vSAN or vVOLs, but it is expected to work.

vVOL considerations:
Understanding virtual machine snapshots within Virtual Volumes (vVols)


Attachments

snapshot_chain_script.sh get_app