In VMware Cloud Director (VCD), after a failed migration using the NSX Migration for VCD tool, named disks may appear stuck in an "Attached" state to VMs that have been deleted or moved. Attempting to detach the disk via the UI fails or does nothing.
10.x
A stale database reference in the vm_disk table maintains a link between the Named Disk and a VM object that is no longer present in the environment.
Take a backup of the VCD Database
Identify the Logical Disk ID and Target orgVDC ID from the VCD UI URL while selecting the objects
Run the following query to find the internal IDs:
SELECT id, fo_id FROM ldisk_fo_join WHERE logical_disk_id = 'YOUR_DISK_ID';
Delete the stale attachment:
DELETE FROM vm_disk WHERE disk_id = 'FO_ID_FROM_STEP_3' AND id = 'ID_FROM_STEP_3';
(Optional) Re-home the disk to the correct Org VDC:
UPDATE logical_disk SET org_vdc_id = 'TARGET_ORG_VDC_ID' WHERE id = 'YOUR_DISK_ID';