Hit the issue in KB59254. There are 512 stale detach entries with perennially reserved flag in VSI node. This caused  the LUN detach failure.

Run this command to find the naa.id devices listed in the VSI nodes

# vsish -e ls /storage/scsifw/persistDeviceAttrs/uids


Run this command to verify if there are 512 devices listed already:

# vsish -e ls /storage/scsifw/persistDeviceAttrs/uids | wc -l


Run this command to remove the perennially reserved flag on those naa.id:

# esxcli storage core device setconfig -d naa.id --perennially-reserved=false

Please enable perennially reserved for cluster RDMs to prevent long ESXi boot up/HBA rescan time. Detach LUN - cannot change the host configuration_Lun Detach LUN - cannot change the host configuration_Lun_02

​Change Perennial Reservation Settings​


1.Mark the devices as perennially reserved.

# esxcli storage core device setconfig -d naa.id --perennially-reserved=true


2.Verify that the device is perennially reserved.

# esxcli storage core device list -d naa.id


In the output of the esxcli command, search for the entry Is Perennially Reserved: true.


3.To remove the perennially reserved flag, run the following command.

# esxcli storage core device setconfig -d naa.id --perennially-reserved=false