Friday 20 May 2011

Unclaiming a device from ESX.


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

Plugin based unclaim.
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

5 comments:

  1. Can you tell how to unclaim a local HDD which is configured as dump partition? My purpose is to enable SSD tagging on that drive.

    ReplyDelete
    Replies
    1. You can deactivate the dumppartition. But if this device is the boot device then unclaim will still not work.You have to add the claim rule and reboot the system so that the SSD claimrule comes into effect.

      Delete
    2. Thanks for the reply.

      Sir, I doubt whether rebooting the ESX host after adding the claim rule will do the trick, why because after rebooting it seems like the claim rule is disappearing.

      In my case, i have a blade server with a local SSD HDD and a SAN stroage running ESXi5.0. I have configured two datastores, one with SSD ( Local disk) and one with SAN.

      From vsphere, its showing as non-ssd drive only and I ran the steps as mentioned in "http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.vsphere.storage.doc_50/GUID-99BB81AC-5342-45E5-BF67-8D43647FAD31.html"

      And while performing the 4th step, ie unclaim the device im getting the same error.

      ~ # esxcli storage core claiming unclaim --type device --device naa.600508b1001c07218341b6e2227982e4

      Unable to perform unclaim. Error message was : Unable to unclaim all requested paths. Some paths were busy or were the last path to an in use device. See VMkernel logs for more information.

      any help?

      Delete
    3. Newly added SSD claimrules will be applied only when VMkernel releases all the devices which are claimed by the current plugin. In your case I believe, there is a scratch partition configured on your SSD device( logs are continuously written here for persistence). Unclaim always fails in this case as VMkernel does an IO on the device. The reason I asked you to reboot the host is, when the esx host comes up, it first reads the /etc/vmware/esx.conf file ( which has SSD settings now) and apply the claimrules for the local devices.


      If SSD rules are still not applied, please post the output of

      esxcli storage core device list

      Also provide the command that you used to add SSD claimrule.

      Delete
  2. Hey Storagemonk,

    It worked like a CHARM!

    What I did is, I performed all the steps mentioned in my above link from vmware except the 4th step ( which is unclaiming) and then rebooted the ESX host and it did the trick!

    Thanks a lot man! Really Appreciated!

    ReplyDelete