Fix VMware APD (All Paths Down) Storage Issues by Removing Detached Devices

I had an ESXi host with dead storage paths causing All Paths Down (APD) issues. The cause was old LUNs that had been detached but were still listed on the host. Removing them from the detached device list cleared it up.

1. List the VMFS Datastores in Use

First confirm which devices back your live datastores, so you don’t remove one by mistake:

~ # esxcli storage vmfs extent list
Volume Name  VMFS UUID                            Extent Number  Device Name                           Partition
-----------  -----------------------------------  -------------  ------------------------------------  ---------
BackupSAN    50eb10a0-4f1a9256-5434-90e2ba22c340  0              naa.6842b2b000687ee500002a4850ea9934  1
Operations   5053a326-370b5095-739a-00137234e92a  0              naa.68b7b2acf4b8d12b3a051502000020ca  1
Templates    506204f5-fe667464-c1b1-90e2ba22c340  0              naa.68b7b2acf4b80148200615353227e7f3  1
CorpStor01   5053a1e4-e68f6227-0e8a-001ec9fd0643  0              naa.68b7b2acf4b8b1163a05e5010000c0a2  1

2. List Detached Devices

~ # esxcli storage core device detached list
Device UID                                                  State
----------------------------------------------------------  -----
naa.6090a058e015725f990965020000a09e                        off
naa.68b7b2acf4b8f10e0d0585010000004c                        off
t10.FreeBSD_iSCSI_Disk______100000010_______________________  off

3. Remove the Stale Detached Devices

esxcli storage core device detached remove -d naa.6090a058e015725f990965020000a09e
esxcli storage core device detached remove -d naa.68b7b2acf4b8f10e0d0585010000004c
esxcli storage core device detached remove -d t10.FreeBSD_iSCSI_Disk______100000010_______________________

Then rescan your storage adapters. The dead paths should be gone.