Connect2Sach
Contributor
Contributor

How to Identify LUN WWN's from ESX 3.5

Jump to solution

hello all

we have environment of Vcenter 2.5 with 3 clusters each cluster having 4 hosts of ESX 3.5. LUN's are allocated to each cluster from EMC clariion and VNX storage boxes. i want know how can i identify the LUN WWN numbers from within ESX console. i tried esxcfg-vmhbadevs -m and esxcfg-mpath -l however from these command i am not able to identify the LUN as the WWN numbers here are of HBA cards. i have WWN numbers of LUNS of both clariion and VNX provided nby our storage team now from these WWN i want to identify which datastore is using which storage ?

any suggestions

0 Kudos
1 Solution

Accepted Solutions
jonathanp
Expert
Expert

can you try to run command from console and post the output?

run the following command

esxcfg-mpath -lv | grep ^Disk | grep -v vmhba0 | awk '{print $2}'

then choose one vmhba device .. i.e : vmhba1:02:03...

run the following command (replace the $entry by the vmhba that you chose)

esxcfg-mpath -lv | grep Disk | grep -v vmhba0 | awk '{print $3,$5,$2}' |  cut -b15- | cut -c 1-32,45- | sort +3 | grep -w $entry | awk '{print  $1}'

Let me know if you still get error...

Otherwise there is also a way to obtain what you need using powerCLI... I have scripts on my other computer, but it is currently not available...

View solution in original post

0 Kudos
4 Replies
jonathanp
Expert
Expert

I had something like this long time ago to create report :

____________________________________________________

#!/bin/sh

file="/tmp/$(hostname)_$(date +%Y_%h_%d_%H%M%p)_Luns.txt"

list_vmhba_devices=`esxcfg-mpath -lv | grep ^Disk | grep -v vmhba0 | awk '{print $2}'`

for entry in $list_vmhba_devices
do
lun_number=`esxcfg-mpath -lv | grep Disk | grep -v vmhba0 | awk '{print $3,$5,$2}' | cut -b15- | cut -c 1-32,45- | sort +3 | grep -w $entry | awk '{print $1}'`
uuid=`esxcfg-vmhbadevs -m | grep -w $entry | awk '{print $3}'`
name=`vmkfstools -P /vmfs/volumes/$uuid | grep "File system label" | awk '{print $6}'`

echo -e "LUN  : $name" >> $file
echo -e "LUN #: $lun_number\n" >> $file

echo "###########################################################################" >> $file

done

___________________________

Message was edited by: jonathanp --- added echo "###########################################################################" >> $file ---- this is to split each lun in the report....

0 Kudos
Connect2Sach
Contributor
Contributor

hi

not sure if i am doing anything wrong here but i am getting below error after execution

> done
[2013-04-19 02:39:01 'StorageInfo' warning] Skipping dir: /vmfs/volumes/29e5f3aa-2d4c14e8. Cannot open volume: /vmfs/volumes/29e5f3aa-2d4c14e8
[2013-04-19 02:39:02 'StorageInfo' warning] Skipping dir: /vmfs/volumes/29e5f3aa-2d4c14e8. Cannot open volume: /vmfs/volumes/29e5f3aa-2d4c14e8
Could not get volume attributes (rv -1)
Error: vmkfstools failed: vmkernel is not loaded or call not implemented.

0 Kudos
jonathanp
Expert
Expert

can you try to run command from console and post the output?

run the following command

esxcfg-mpath -lv | grep ^Disk | grep -v vmhba0 | awk '{print $2}'

then choose one vmhba device .. i.e : vmhba1:02:03...

run the following command (replace the $entry by the vmhba that you chose)

esxcfg-mpath -lv | grep Disk | grep -v vmhba0 | awk '{print $3,$5,$2}' |  cut -b15- | cut -c 1-32,45- | sort +3 | grep -w $entry | awk '{print  $1}'

Let me know if you still get error...

Otherwise there is also a way to obtain what you need using powerCLI... I have scripts on my other computer, but it is currently not available...

0 Kudos
Connect2Sach
Contributor
Contributor

Perfect man...

i choose one vmhba and run the command and did get the WWN of one of my LUN. Now i have all WWN numbers can it be possible get the corresponding vmhba numbers so that i can find the datastores ?

0 Kudos