Many deleted VMs are still showing in the vSAN Datastore.
search cancel

Many deleted VMs are still showing in the vSAN Datastore.

book

Article ID: 404821

calendar_today

Updated On:

Products

VMware vSAN VMware Horizon 8 VMware vSAN 7.x VMware vSAN 8.x

Issue/Introduction

VMs have been deleted from vCenter but still show up in the vSAN datastore and cannot be deleted. 

failed with the error 'Cannot delete file [vsanDatastore] <uuid>'

Environment

VMware Horizon 8.x
VMware vSAN 7.x
VMware vSAN 8.x

Cause

The issue is a result of how the object is created by VDI.
This is caused by the flag "ddb.deletable = false" being present in the vmdk descriptor file.

Resolution

Use following workaround to delete the object.

Workaround:

The command below can be used to remove the line from all VMDK descriptor files in a given VM namespace.

.

sed -i '/ddb.deletable/d' /vmfs/volumes/vsanDatastore/VM-Namespace/*.vmdk

After performing this change, the file/folder can be deleted via the vSphere Client in the datastore browser.

Additional Information

VMs created via the VDI client have  "ddb.deletable = false" flag in the vmdk descriptor to protect it against accidental deletion.