Snapshot Deletion Fails with "Virtual Machine or Snapshot Already in Use" Error - VMware vSphere ESXi
search cancel

Snapshot Deletion Fails with "Virtual Machine or Snapshot Already in Use" Error - VMware vSphere ESXi

book

Article ID: 413149

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • When attempting to remove snapshots from a virtual machine, the task may fail with the error:

    "One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot."

    This indicates a logical inconsistency in the snapshot disk chain metadata.

    Task name: Remove snapshot
    Status  An error occurred while deleting a snapshot: 
    One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot.
  • In /vmfs/volumes/<datastore_name>/<virtual_machine_name>/vmware.log, displayed messages are similar to the following, indicating that the same VMDK file is already opened by another snapshot:
    SNAPSHOT: SnapshotDiskTreeAddFromSnapshot: Trying to add snapshot ###-Snapshot2.vmsn to disk /vmfs/volumes/.../###.vmdk which already has snapshot ###-Snapshot1.vmsn.
    SNAPSHOT: SnapshotGenerateDeleteDisks Failed to fetch disk tree: One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot (21)
    SNAPSHOT: SnapshotDeleteNode failed: One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot (21)
  • Snapshot creation succeeds, but deletion fails
  • OVF export tasks may also fail
  • Powering on virtual machine may fail with error
     "Operation failed" Status: Failed to enumerate all disks. One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot

Environment

  • VMware vSphere ESXi 7.x, 8.x
  • VMware vCenter Server 7.x, 8.x

Cause

A corruption or metadata inconsistency exists within the .vmsd file. This usually occurs when multiple snapshot entries reference the same base VMDK file, creating a circular or invalid hierarchy that triggers a safety lock on the disks.

  • The virtual_machine_name.vmsd file, located in /vmfs/volumes/<datastore_name>/<virtual_machine_name>/, contains entries similar to the following:

    snapshot0.uid = "1"
    snapshot0.filename = "Direct-###-Snapshot1.vmsn"
    snapshot0.disk0.fileName = "Direct-###01.vmdk"
    snapshot0.disk0.node = "scsi0:0"
    
    snapshot1.parent = "1"
    snapshot1.uid = "2"
    snapshot1.filename = "Direct-###-Snapshot2.vmsn"
    snapshot1.disk0.fileName = "Direct-###01.vmdk"
    snapshot1.disk0.node = "scsi0:0"
  • The simultaneous reference to the same base VMDK file by snapshot0 and snapshot1 creates a logical inconsistency in the snapshot chain, despite their parent–child relationship. As a result, the disk is detected as "in use" during deletion, and the snapshot removal process fails.

Resolution

Important: Before proceeding, ensure a full backup of the affected virtual machine is completed.

  1. Identify the VMDK file containing the most recent VM data.
  2. Clone the identified VMDK using vmkfstools to preserve the latest disk state. Kindly refer to the KB 343140 for cloning a disk using the vmkfstools command.
  3. Establish an SSH session to the ESXi host where the virtual machine is currently registered.
  4. Navigate to the virtual machine’s configuration directory:
    cd /vmfs/volumes/datastore_name/virtual_machine_name/
  5. Rename or remove the existing .vmsd file:
    mv virtual_machine_name.vmsd virtual_machine_name.vmsd.bak
  6. Power on the virtual machine.
  7. In the vSphere Client, verify whether a disk consolidation warning is displayed. If prompted, initiate disk consolidation by navigating to:
    VM > Actions > Snapshots > Consolidate
  8. After successful consolidation, validate snapshot functionality by creating and deleting a new snapshot.

 

Additional Information