Need for unclaiming an ESX device usually arises when you want to change, the plugin claiming the device or paths to the device. For example if you want to mask a device, then you may need to first add the claimrules and then unclaim the claimrules that are currently acting upon the devices.
User needs to note that, path, adapter, plugin etc based unclaims succeed only when device is free. In other words device should not be actively servicing IOs. If VMs are powered on, or there are IOs issued to a RDM disks, then the command is bound to fail. Unclaim often fails on local disks, as you may have scratch partition and dump partition configured on it.
There are different ways to unclaim a device.
You can uncalim claimrules on device basis as follows
~ # esxcli corestorage claiming unclaim -t device --device naa.6009999999999284000064c349cc3cd9
Claimrules can also be claimed on basis of device vendor names too.
~ # esxcli corestorage claiming unclaim -t vendor --vendor IBM
In ESX user can unclaim claimrules based on path too.
esxcli corestorage claiming unclaim -t path --path vmhba2:C0:T0:L111
Less popular version are:
Driver based unclaiming
~# esxcli corestorage claiming unclaim -t driver --driver qla2xxx
There is also provision to unclaim devices on basis of plugin names.
~ # esxcli corestorage claiming unclaim -t plugin --plugin MASK_PATH
If all the claimrules are hard to remember, the you can try to unclaim all the devices in ESX.
ESX will try to unclaim all the claimrules working on non busy devices. Please note that this command will return device busy messages in most of the case as it tries to unclaim the local disk too,where user might have configured swap,dump and scratch partitions.
~ # esxcli corestorage claiming unclaim -t location
Errors:
Unable to perform unclaim. Error message was : Unable to unclaim paths. Busy or in use devices detected. See VMkernel logs for more information.
After unclaiming do not forget to load and run the new claimrules. Load and Run operations will read /etc/vmware/etc.conf file and apply the claimrules to unclaimed devices.
~ # esxcli corestorage claimrule load
~ # esxcli corestorage claimrule run