This post will be an extension of the VCAP6-DCV Objective 2.1
LUN Masking using PSA Commands
I’ll be using host ESXi-01 and the LUN named ‘mask_lun’
We’ll be doing the work directly connected to the host via the shell interface.
Let’s get started…
Get the Device ID:
1 2 3 4 5 6 7 8 |
#Command esxcfg-scsidevs -m #Output mpx.vmhba1:C0:T0:L0:3 /vmfs/devices/disks/mpx.vmhba1:C0:T0:L0:3 5820e310-710c98b9-6ffc-000c2987e1 d7 0 datastore1 naa.60003ff44dc75adcb9fb6afc3bd6a94a:1 /vmfs/devices/disks/naa.60003ff44dc75adcb9fb6afc3bd6a94a:1 582b3bd6-e2161002-402d-000c2987e1 d7 0 mask_lun |
Get the Path for that Device:
1 2 3 4 5 6 7 8 |
#Command esxcfg-mpath -L | grep -i 60003ff44dc75adcb9fb6afc3bd6a94a #Output vmhba33:C1:T0:L0 state:active naa.60003ff44dc75adcb9fb6afc3bd6a94a vmhba33 1 0 0 NMP active san iqn.1998-01.com.vmware:esxi-01-689fb082 00023d000002,iqn.1991-05.com.mnfiler01-new-hosts-11-7-2016-target,t,1 vmhba33:C0:T0:L0 state:active naa.60003ff44dc75adcb9fb6afc3bd6a94a vmhba33 0 0 0 NMP active san iqn.1998-01.com.vmware:esxi-01-689fb082 00023d000001,iqn.1991-05.com.mnfiler01-new-hosts-11-7-2016-target,t,1 |
List the current claimrules:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#Command esxcli storage core claimrule list #Output Rule Class Rule Class Type Plugin Matches XCOPY Use Array Reported Values XCOPY Use Multiple Segments XCOPY Max Transfer ---------- ----- ------- --------- --------- --------------------------------- ------------------------------- --------------------------- ------------------- MP 0 runtime transport NMP transport=usb false false MP 1 runtime transport NMP transport=sata false false MP 2 runtime transport NMP transport=ide false false MP 3 runtime transport NMP transport=block false false MP 4 runtime transport NMP transport=unknown false false MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport false false MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport false false MP 65535 runtime vendor NMP vendor=* model=* false false |
Now we need to Create a Claimrule that will mask our paths to the LUN
1 2 3 4 |
#Command esxcli storage core claimrule add -u -t location -A vmhba33 -C 0 -T 0 -L 0 -P MASK_PATH esxcli storage core claimrule add -u -t location -A vmhba33 -C 1 -T 0 -L 0 -P MASK_PATH |
List claimrules to verify they were created:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#Command esxcli storage core claimrule list #Output Rule Class Rule Class Type Plugin Matches XCOPY Use Array Reported Values XCOPY Use Multiple Segments XCOPY Max Tr ---------- ----- ------- --------- --------- ---------------------------------------- ------------------------------- --------------------------- ------------ MP 0 runtime transport NMP transport=usb false false MP 1 runtime transport NMP transport=sata false false MP 2 runtime transport NMP transport=ide false false MP 3 runtime transport NMP transport=block false false MP 4 runtime transport NMP transport=unknown false false MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport false false MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport false false MP 5001 file location MASK_PATH adapter=vmhba33 channel=0 target=0 lun=0 false false MP 5002 file location MASK_PATH adapter=vmhba33 channel=1 target=0 lun=0 false false MP 65535 runtime vendor NMP vendor=* model=* false false |
Load them to runtime:
1 2 3 |
#Command esxcli storage core claimrule load |
Check/list them:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#Command esxcli storage core claimrule list #Output Rule Class Rule Class Type Plugin Matches XCOPY Use Array Reported Values XCOPY Use Multiple Segments XCOPY Max Tr ---------- ----- ------- --------- --------- ---------------------------------------- ------------------------------- --------------------------- ------------ MP 0 runtime transport NMP transport=usb false false MP 1 runtime transport NMP transport=sata false false MP 2 runtime transport NMP transport=ide false false MP 3 runtime transport NMP transport=block false false MP 4 runtime transport NMP transport=unknown false false MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport false false MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport false false MP 5001 runtime location MASK_PATH adapter=vmhba33 channel=0 target=0 lun=0 false false MP 5001 file location MASK_PATH adapter=vmhba33 channel=0 target=0 lun=0 false false MP 5002 runtime location MASK_PATH adapter=vmhba33 channel=1 target=0 lun=0 false false MP 5002 file location MASK_PATH adapter=vmhba33 channel=1 target=0 lun=0 false false MP 65535 runtime vendor NMP vendor=* model=* false false |
Reclaim them from the Native Multi-pathing Device (NMP):
1 2 3 |
#Command esxcli storage core claiming reclaim -d naa.60003ff44dc75adcb9fb6afc3bd6a94a |
Verify the paths no longer exist:
1 2 3 |
#Command esxcfg-mpath -L | grep -i naa.60003ff44dc75adcb9fb6afc3bd6a94a |
To UNMASK the paths we essentially do the reverse.
UNMASK Lun Paths
Remove the claimrules:
1 2 3 4 5 |
#Command esxcli storage core claimrule remove -r 5001 esxcli storage core claimrule remove -r 5002 |
Load the claimrules:
1 2 3 |
#Command esxcli storage core claimrule load |
Unclaim the paths:
1 2 3 4 5 |
#Command esxcli storage core claiming unclaim -t location -C 0 -T 0 -L 0 esxcli storage core claiming unclaim -t location -C 1 -T 0 -L 0 |
Rescan the vmhba:
1 2 3 |
#Command esxcli storage core adapter rescan -A vmhba33 |
Verify the paths have returned:
1 2 3 4 5 6 7 |
#Command esxcfg-mpath -L | grep -i naa.60003ff44dc75adcb9fb6afc3bd6a94a #Output vmhba33:C1:T0:L0 state:active naa.60003ff44dc75adcb9fb6afc3bd6a94a vmhba33 1 0 0 NMP active san iqn.1998-01.com.vmware:esxi-01-689fb082 00023d000002,iqn.1991-05.com.microsoft:winfiler01-new-hosts-11-7-2016-target,t,1 vmhba33:C0:T0:L0 state:active naa.60003ff44dc75adcb9fb6afc3bd6a94a vmhba33 0 0 0 NMP active san iqn.1998-01.com.vmware:esxi-01-689fb082 00023d000001,iqn.1991-05.com.microsoft:winfiler01-new-hosts-11-7-2016-target,t,1 |