Wednesday, September 21, 2016

Get list of desired LUN id from powermt output

Requirement : You have a list of disk names from OS end and you need to get their respective LUN ids from powermt output. This ... thumbnail 1 summary
Requirement :

You have a list of disk names from OS end and you need to get their respective LUN ids from powermt output.

This requires manual work of searching each disk name in powermt output and then copying its respective LUN id. Typically these two lines you are interested in output.

Pseudo name=emcpoweraa
Symmetrix ID=000549754319
Logical device ID=03C4
If you have list of disks to search its a tedious task.

Image source : freeimages


Solution :

Get ouput of powermt in a file


# powermt display dev=all > powermt.old


Get all disk names in one file e.g. test.txt
Run a for loop which will get LUN id of each disk described in file.


# for i in `cat test`
do
cat powermt.old |grep -A 2 $i|grep Logical|awk '{print $3}'|cut -d= -f2
done


You will be presented with the list of LUN ids for respective disks in the test.txt file!

Vice versa: Get disk names by giving LUN ids in text.txt file.


# for i in `cat test`
do 
cat powermt.old |grep -B 2 $i|grep Pseudo|awk '{print $2}'|cut -d= -f2
done



No comments

Post a Comment

Any thoughts?