Quantcast
Viewing all articles
Browse latest Browse all 237662

Re: How to Identify LUN WWN's from ESX 3.5

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....


Viewing all articles
Browse latest Browse all 237662

Trending Articles