Thursday, August 23, 2012

Script to Find Out Lun ID of Give mount point of EMC storage.

#!/bin/bash

read -e -p "Enter mount point which u want to find lun ID eg./data3: " mount_point
#read mount_point;
lvname=`mount | grep $mount_point | cut -d " " -f1`;
#echo $lvname;
physical_vol_name=`lvdisplay -m $lvname | grep "Physical volume" | awk '{print $3}'|sed -e 's/.*\/dev\///' -e 's/\/.*//'|sed 's/[0-9]*//g'`;
#echo $physical_vol_name
lun_id=`powermt display dev=$physical_vol_name | grep -i "Logical device ID"`
echo "$lun_id  is Lun ID of mount point $mount_point"