Delete Orphaned Virtual Disks from a VM
search cancel

Delete Orphaned Virtual Disks from a VM

book

Article ID: 425198

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Symptoms:

  • Discrepancy between datastore "Used Space" and the actual size of active VM disks.

  • Necessity to identify and delete unmapped .vmdk files that were not removed during previous VM hardware reconfigurations.

  • Need to reclaim storage by purging detached virtual disks that are no longer providing value to the production environment.

  • "Zombie" or "Ghost" disks in the Datastore Browser that do not appear in any VM's Edit Settings menu.

Environment

vSphere vCenter 8.0

vSphere ESXi 8.0

Resolution

Note: Before deleting any files, it is critical to verify the content to ensure no data loss occurs. Follow these steps to safely identify and reclaim the space:

Step 1: Data Verification (Optional but Recommended)

If you are unsure of the contents of the old disk:

  1. Select a temporary or "Helper" VM.

  2. Go to Edit Settings > Add New Device > Existing Hard Disk.

  3. Browse the datastore and select the orphaned .vmdk file.

  4. Power on the VM (or let the OS scan the disk) to verify if the files are truly obsolete.

  5. Once confirmed, Remove the hardware from the VM settings (ensure you do not delete it yet if you want to use the automated cleanup below).

Step 2: Clean up Snapshots and "Ghost" Files

If the disk is verified as unnecessary:

  1. Consolidate Snapshots: If the VM attached to that datastore has active snapshots, perform a Delete All Snapshots to merge data and release locked blocks.

  2. Storage vMotion: The most effective way to clear "leftover" files is to migrate the active VM to a different datastore.

    • Right-click the VM > Migrate > Change Storage Only.

    • VMware will only move files explicitly listed in the .vmx file.

    • Any files remaining on the Source Datastore after the migration are confirmed "orphans" and can be safely deleted.

Step 3: Manual Deletion

After performing Step 2, if the identified 2023 HDD files still reside on the original datastore:

  1. Open the Datastore Browser.

  2. Locate the folder containing the orphaned files.

  3. Select the .vmdk and associated -flat.vmdk files.

  4. Click Delete from Disk.

Additional Information

Warning: Always ensure you have a valid full backup of the environment before manually deleting files from a datastore. If the file is a "Base" disk for a linked clone, deleting it could corrupt multiple VMs.