I’m going to mask “VMFS-3-DS03” datastore from these claimrules
Note: If it is difficult to see the outputs, click on the Image for a better view.
First of all you can view all the existing claimrules from “esxcli storage core claimrule list” command
Use “esxcfg-scsidevs -m” command to view and list all the devices along with the datastore names and device IDs. I have highlighted the device which I’m going to mask.
There are few parameters I used to create the command.
- rule id – you need to use one of the rule ID which is not used in the list. Please find the below rule ID definitions
- 0 – 100 – reserved for VMware internal usage
- 101 – 65435 – for general use, you need to select one of the ID from this range (I used 105)
- 65436 – 65535 – reserved for VMware internal usage
- -t – refers to the “Target” and we are going to point the location as the target. You can get more information from this KB article. You need to point the device using these switches.
- -A – refers to the Adapter
- -P – refers to the Plugin , I used “MASK_PATH” plugin to mask the device
Check the rule list whether your rule is in the list, you will be able to see the rule now. To view use “esxcli storage core claimrule list” command again
Now load the claimrule , use “esxcli storage core claimrule load”
Check and confirm the run time rule again
Type “esxcli storage core claiming reclaim -d <device id>”
Type “esxcli storage core claiming unclaim -d <device id> -t location” command and it will give you an error message but don’t worry.
Type “esxcli storage core claimrule run” to run the new associations
That’s all now, rescan your HBA and see the Datastore availability.
Oops! it’s still there.. That’s where my iSCSI multipathing comes in to play. check the device paths using “esxcfg-mpath -L | grep “<device ID>”. There should be only one path available.
Do the same steps to mask this path to the ESXi Server. You need to use a different rule ID for this I used 106 as the second rule ID.
Rule list output should be like this
Once you successfully completed the above tasks check the datastore availability. Now you won’t be able to see the Datastore anymore.
Check the visible devices and ESXi host won’t see the device
Remove Core Claimrule and Remove the masking
Now we need to remove the claimrule and remove the masking. To remove the rule type “esxcli storage core cliamrule remove –rule 105” and load the claimrule using “esxcli storage core claimrule load”
This will remove the rule but run time rule will be there
Perform the reclaiming and unclaiming steps and run the claim rules
Now check the list and confirm the runtime rule status. Runtime rule also should not be there.
Now do a rescan of the HBAs and VMFS , you will be able to see the datastore again.
Check the visible path of the device and you can see only one path to the device.
Following the same process you can remove the other rule and will be able remove the Masking.
Hope you enjoyed my post even though it is a lengthier one, Thank You.

Leave a Reply