This article provides steps for un-presenting a LUN containing a datastore from an ESXi host without removing the contents of the datastore.
Note: Deleting a datastore from vCenter Server and subsequent un-presentation of the LUN containing that datastore is effective most of the time. Removing a LUN without masking the LUN causes the host to continuously retry access to the LUN, and leads to an All-Paths-Down (APD) condition on the host. For more information, see VMware ESXi hosts in All-Paths-Down (APD) condition may appear as Not Responding in VMware vCenter Server.
Un-presenting a LUN containing a datastore from host includes the following steps. Only execute Step 2 if you intend to discard the LUN in question. All other steps must be done.
Note: These steps must be performed using the ESX service console or the vSphere command line. These steps cannot be performed using the Manage Paths dialog in the vSphere Client.
To identify the volume in question:
esxcfg-scsidevs --vmfs
mpx.vmhba0:C0:T0:L0:5 /dev/cciss/c0d0p5 4a9fd860-6098929b-70e1-001e0b1df518 0 Storage2
naa.60a9800050334c424a6f55566d466f31:1 /dev/sdd1 4b5f0b60-a09c425d-3953-001e0b1df518 0 NetApp_iSCSI
naa.6006016033201c00a43a4ab9be9cde11:1 /dev/sda1 4bc37846-18f3c301-2ecb-001e0b1df518 0 delete_datastore
delete_datastore
has naa.6006016033201c00a43a4ab9be9cde11
, which is the NAA ID. You may also see an EUI ID, or a T10 ID, which are fully interchangeable.vml.XXX
number. This is the vml.ID
to be used in the next step.esxcfg-scsidevs –u | grep –i vml.ID
vmhba
identifiers.esxcfg-mpath –L | grep naa.ID
# esxcfg-mpath -L | grep -i naa.6006016033201c00a43a4ab9be9cde11
vmhba1:C0:T1:L1 state:standby naa.6006016033201c00a43a4ab9be9cde11 vmhba1 0 1 1 NMP standby san fc.20000000c9739842:10000000c9739842 fc.50060160c1e0b7ec:5006016941e0b7ec
vmhba1:C0:T0:L1 state:active naa.6006016033201c00a43a4ab9be9cde11 vmhba1 0 0 1 NMP active san fc.20000000c9739842:10000000c9739842 fc.50060160c1e0b7ec:5006016141e0b7ec
vmhba0:C0:T1:L1 state:standby naa.6006016033201c00a43a4ab9be9cde11 vmhba1 0 1 1 NMP standby san fc.20000000c9739842:10000000c9739842 fc.50060160c1e0b7ec:5006016941e0b7ec
vmhba0:C0:T0:L1 state:active naa.6006016033201c00a43a4ab9be9cde11 vmhba1 0 0 1 NMP active san fc.20000000c9739842:10000000c9739842 fc.50060160c1e0b7ec:5006016141e0b7ec
vmhba1:C0:T1:L1
and vmhba1:C0:T0:L1
, breaks down to HBA1/0, Controller 0, Target (SP) 1/0, Lun 1
.Note: For RDMs, skip this section. Similarly, skip this step if you intend to preserve the data on in the datastore in question. This step will destroy the partition table on the LUN.
To delete the VMFS datastore:
esxcli corestorage claimrule add --rule 192 –t location –A vmhba1 –L 1 –P MASK_PATH
esxcli corestorage claimrule add --rule 193 –t location –A vmhba0 –L 1 –P MASK_PATH
-t
location and -P MASK_PATH
are mandatory. The other options are optional and are based on your environment. This example specifies both HBAs (vmhba0
and vmhba1
), no controller (masking all controllers), no target (masking all targets), and LUN1 (masking only LUN1). If your storage uses targets to differentiate LUNs, you may want to specify the appropriate target with -T X
. For more information, see the example at the end of this article.esxcli corestorage claimrule load
esxcli corestorage claimrule list
# esxcli corestorage claimrule list
Rule Class Type Plugin Matches
0 runtime transport NMP transport=usb
1 runtime transport NMP transport=sata
2 runtime transport NMP transport=ide
3 runtime transport NMP transport=block
4 runtime transport NMP transport=unknown
101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport
101 file vendor MASK_PATH vendor=DELL model=Universal Xport
192 runtime location MASK_PATH adapter=vmhba1 channel=* target=* lun=1
192 file location MASK_PATH adapter=vmhba1 channel=* target=* lun=1
193 runtime location MASK_PATH adapter=vmhba1 channel=* target=* lun=1
193 file location MASK_PATH adapter=vmhba1 channel=* target=* lun=1
65535 runtime vendor NMP vendor=* model=*
esxcli corestorage claiming reclaim –d naa.ID
grep vmkernel /var/log/messages
cat /var/log/vmkernel
Apr 12 16:18:03 ds-tse-h12 vmkernel: 4:03:31:44.853 cpu7:4109)WARNING: NMP: nmp_UnclaimPath: Physical path "vmhba1:C0:T1:L1" is the last path to NMP device "Unregistered Device". The NMP device has been unregistered.
cat /var/log/messages |grep -i apd
egrep –i apd /var/log/vmkernel
esxcli corestorage claimrule delete --rule 192
esxcli corestorage claimrule load
esxcli corestorage claimrule list
# esxcli corestorage claimrule list
Rule Class Type Plugin Matches
0 runtime transport NMP transport=usb
1 runtime transport NMP transport=sata
2 runtime transport NMP transport=ide
3 runtime transport NMP transport=block
4 runtime transport NMP transport=unknown
101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport
101 file vendor MASK_PATH vendor=DELL model=Universal Xport
65535 runtime vendor NMP vendor=* model=*
Some arrays use storage by target instead of storage by LUN. On a traditional array, such as Clariion and HP EVA, each controller is a target and individual volumes are specified by LUN number. On a target-based array, such as Equallogic and LeftHand, each volume is a separate SCSI target, each with LUN0. On these arrays, the output of the esxcfg-mpath
appears similar to:vmhba33:C0:T2:L0 state:active naa.6000eb395d4b82660000000000000010 vmhba33 0 2 0 NMP …
vmhba33:C0:T1:L0 state:active naa.6000eb395d4b82660000000000000012 vmhba33 0 1 0 NMP …
vmhba33:C0:T0:L0 state:active naa.6000eb395d4b82660000000000000014 vmhba33 0 0 0 NMP …
On each line of the output, you see L0
for LUN 0 and T0/1/2
for each of the actual volumes.
In this case, the masking commands are different and you must mask the target instead of the LUN. For example, use a command similar to:esxcli corestorage claimrule add --rule 192 -t location -A vmhba33 -T 1 -P MASK_PATH
This command masks target 1, LUN 0.
All Paths Down for a storage device
How to unmount a LUN or detach a datastore device from ESXi hosts