LUN Related Queries
The following
commands can be used to retrieve information about the LUN details and LUN path
configuration on the ESX host. The selected list of commands were chosen based
on usefulness. For example, having a count of various types of LUNs, the number
of paths per HBA, the total number of paths, and so on.
List unique paths
esxcli
storage nmp path list | grep fc | uniq
Count unique paths
esxcli
storage nmp path list | grep fc | uniq | wc -l
Note:
This number is important. With ESXi 5.x there is a limit of 1024 paths. All
types of paths count against this value, whether they are due to additional HBA
ports, FA ports, or otherwise. In large environments, it is quite easy to reach
this limit.
List path status for each LUN
esxcfg-mpath
-b |grep -B1 "fc Adapter"| grep -v -e "--" |sed
's/Adapter.*//'
Sample:
naa.6007898044789300d0e32c98a509f314
: DGC Fibre Channel Disk (naa.6007898044789300d0e32c98a509f314)
vmhba2:C0:T9:L1 LUN:1 state:active fc
vmhba4:C0:T8:L1 LUN:1 state:active fc
vmhba4:C0:T9:L1 LUN:1 state:active fc
vmhba2:C0:T8:L1 LUN:1 state:active fc
naa.60080831873001e007b9f33f83689df11
: DGC Fibre Channel Disk (naa.60080831873001e007b9f33f83689df11)
vmhba5:C0:T1:L23 LUN:23 state:active fc
Path details for a LUN
esxcli
storage nmp path list --device <device naa ID> |grep fc
Example:
esxcli
storage nmp path list --device naa.6007898044789300d0e32c98a509f314 |grep fc
fc.30003441bd69284:21000043bd69284-fc.60893310bad02cdf:500819443ce02c6f-naa.6007898044789300d0e32c98a509f314
fc.30003441bd691ac:21000043bd691ac-fc.60893310bad02cdf:5008194e3ce02c6f-naa.6007898044789300d0e32c98a509f314
fc.30003441bd691ac:21000043bd691ac-fc.60893310bad02cdf:500819453ce02c6f-naa.6007898044789300d0e32c98a509f314
fc.30003441bd69284:21000043bd69284-fc.60893310bad02cdf:5008194c3ce02c6f-naa.6007898044789300d0e32c98a509f314
Path status for a LUN
esxcli
storage nmp path list --device <device naa ID>
Example:
esxcli
storage nmp path list --device naa.6007898044789300d0e32c98a509f314
fc.20000033bd69584:21000043bd69284-fc.50030160bad02cdf:500819443ce02c6f-naa.6007898044789300d0e32c98a509f314
Runtime Name: vmhba2:C0:T8:L1
Device: naa.6007898044789300d0e32c98a509f314
Device Display Name: DGC Fibre Channel Disk
(naa.6007898044789300d0e32c98a509f314)
Group State: active
Array Priority: 1
Storage Array Type Path Config:
{TPG_id=1,TPG_state=AO,RTP_id=5,RTP_health=UP}
Path Selection Policy Path Config: PSP
VMW_PSP_RR does not support path configuration.
fc.20000033bd6891ac:21000043be691ac-fc.50030118bad02cdf:5008194c3ce02c6f-naa.6007898044789300d0e32c98a509f314
Runtime Name: vmhba4:C0:T9:L1
Device: naa.6007898044789300d0e32c98a509f314
Device Display Name: DGC Fibre Channel Disk
(naa.6007898044789300d0e32c98a509f314)
Group
State: active unoptimized
Array Priority: 0
Storage Array Type Path Config:
{TPG_id=2,TPG_state=ANO,RTP_id=14,RTP_health=UP}
Path Selection Policy Path Config: PSP
VMW_PSP_RR does not support path configuration.
Set Perennial Reservation
Example:
esxcli
storage core device setconfig -d naa.6000b79c000317a10a4b8206d2825a83
--perennially-reserved=true
Find LUNs with and without Perennial Reservations
esxcli
storage core device list | grep "Is Perennially Reserved: true" -B18
| grep naa
esxcli
storage core device list | grep "Is Perennially Reserved: false" -B18
| grep naa
Find "offline" LUNs
esxcli
storage core device list | grep "Is Offline: true" -B17 | grep naa
Find permanently detached devices (find permanently
inaccessible LUNs)
esxcli
storage core device detached list
Find "Status: unknown"
esxcli
storage core device list | grep -v "Thin" | grep "Status: unknown" -B12 | grep naa
Total
LUN count
esxcli
storage core device list | grep Vendor | wc -l
LUN Count by vendor name
Examples:
esxcli
storage core device list | grep Vendor | grep EMC | wc -l
esxcli
storage core device list | grep Vendor | grep DGC | wc -l
List Vendors
esxcli
storage core device list | grep Vendor | sort | uniq
Sample Output:
Vendor: DELL
Vendor: DGC
Vendor: DP
Vendor: EMC
Vendor: TSSTcorp
Vendor: iDRAC
Vendor: IBM
Count of LUNs per Vendor
esxcli
storage core device list | grep Vendor | sort | uniq -c
Sample Output:
1
Vendor: DELL
54
Vendor: DGC
1
Vendor: DP
110
Vendor: EMC
87
Vendor: IBM
1
Vendor: TSSTcorp
2
Vendor: iDRAC
Count paths per unique LUN
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f3 | sort| uniq -c
Sample Output:
3 naa.60080831873001e00e26d1945094fe311
3 naa.60080831873001e00f2655ba63689df11
3 naa.60080831873001e00f3655ba63689df11
3 naa.60080831873001e00f4655ba63689df11
4 naa.6006898025782100483e7b4bdbedf314
4 naa.60068980257821005ceed1735c11f314
Count Total Number of paths
esxcli
storage nmp path list | grep "fc\." | wc -l
Count Number of LUNs per HBA
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f1 | sort| uniq -c
174 fc.20000043bd691ac:21000033bd691ac
160 fc.20000043bd691ad:21000033bd691ad
130 fc.20000043bd69284:21000033bd69284
Count number of LUNs visible per FA (counts LUNs more
than once)
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f2 | sort| uniq -c
110
fc.500009321498a000:500009321498a1dc
1 fc.5000143047324698:50001442a0461500
2 fc.5000143047324698:50001443a0461501
1 fc.500014404770465c:50001442b0465c00
2 fc.500014404770465c:50001442b0465c01
22 fc.500143800200096a:500143810200096a
Notes: Breakdown of this
output
fc.20000043bd691ac:21000043bd691ac-fc.50081940bce02c69:500819463ce02c69-naa.60080831873001e00f2655ba63689df11
HBA
FA
LUN
Count of LUNs with a single path
Note:
Does not detect multiple paths on a single HBA.
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f3 | sort| uniq -c
| grep "1 naa" | wc -l
List of LUNs with paths only on a single HBA
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f1,3 | sort| uniq |
cut -d '-' -f2 | sort | uniq -c | grep "1 naa"
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f1,3 | sort| uniq |
cut -d '-' -f2 | sort | uniq -c | grep "1 naa" | cut -d ' ' -f8
Count of LUNs with paths only on a single HBA
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f1,3 | sort| uniq |
cut -d '-' -f2 | sort | uniq -c | grep "1 naa" | wc -l
Count paths per unique LUN
esxcli
storage nmp path list | grep "fc\." | cut -d '-' -f3 | sort| uniq -c
Identify list of HBA's
esxcli
storage nmp path list | grep "fc\." |
cut -d '-' -f1 | sort | uniq
No comments:
Post a Comment