Tuesday, October 2, 2012

Best Practice: VMWARE: Unpresenting a LUN on ESXi 5.0



Delete / Remove dead path http://raj2796.wordpress.com/2012/03/14/vmware-vsphere-5-dead-lun-and-pathing-issues-and-resultant-scsi-errors/


LIST of COMMANDS

~ # esxcli storage core device list|grep off -B12
~ # esxcli storage core device set --state=off -d naa.600c0ff00011d0284ca76c5001000000
~ # esxcli storage core device detached list
~ # partedUtil getptbl /vmfs/devices/disks/naa.600c0ff00011d028364bd54d01000000
~ # esxcli storage core adapter rescan -A vmhba1
~ # esxcli storage core adapter rescan -A vmhba2
~ # esxcli storage core adapter rescan --all


STEPS

  1. Getting the NAA ID of the LUN to be removed
    # esxcli storage vmfs extent list

  1. Unpresenting a LUN from vSphere Client
    • If the LUN is an RDM, skip to next step. Otherwise, in the Configuration tab of the ESXi host, click Storage. Right-click the datastore being removed, and click Unmount.

      Note: To unmount a datastore from multiple hosts, from the vSphere Client select Hosts and Clusters, Datastores and Datastore Clusters view (Ctrl+Shift+D)
    •  Choose the Devices View (Under Configuration > Storage > Devices tab):
      Right-click the NAA ID of the LUN (as noted above) and click Detach. A Confirm Device Unmount window is displayed. When the prerequisite criteria have been passed, click OK.  Perform individually on all hosts

In our case vc wasn’t an option since the hosts were unresponsive and vc couldn’t communicate, also the luns were allready detached since they were never used, so :
list permanently detached devices:
# esxcli storage core device detached list
look at output at state off luns e.g.
Device UID                            State
————————————  —–
naa.50060160c46036df50060160c46036df  off
naa.6006016094602800c8e3e1c5d3c8e011  off
next permanently remove the device configuration information from the system:
# esxcli storage core device detached remove -d
e.g.
# esxcli storage core device detached remove  -d naa.50060160c46036df50060160c46036df

OR

To detach a device/LUN, run this command:
# esxcli storage core device set –state=off -d
To verify that the device is offline, run this command:
# esxcli storage core device list -d


No comments: