Tuesday, September 22, 2015

how to get Lun Id's for the ASM raw devices for EMC and Hitachi... AIX

Below information will be handy when you want to know the lun id'd for the raw devices you are using in the ASM environment ..there is a small difference in syntax ....when you use EMC's or Hitachi as your Storage..... the script only works if the server is NPIV connected..

set heading off
set feedback off
set echo off
set pagesize 0
col NAME for a30
col PATH for a30
spool asm_info.log
select NAME,PATH from V$ASM_DISK;
spool off

EMC......

cat asm_info.log| awk '{print $2}'|cut -c7- > asm_info_cut.log
cat asm_info_cut.log|while read disk
do
echo "$disk          `lscfg -vps -l $disk|grep LIC|cut -c37,38,39,40,41`" >> asm_disk_lun_info.log
done
paste asm_info.log asm_disk_lun_info.log| awk '
BEGIN { format = "%-29s %-28s %-28s %s\n"
printf format, "ASM_groups", "ASM_Disk_PATH", "UNIX_Disk", "LUN/Device_id"
printf format, "----------", "-------------", "---------", "-------------"}
{for(i=1;i<=NF;i++)
printf("%-30s%c", $i, (i==NF) ? ORS : "")}' >> asm_info_final.log;
exit;


Hitachi.....

cat asm_info.log| awk '{print $2}'|cut -c7- > asm_info_cut.log
cat asm_info_cut.log|while read disk
do
echo "$disk          `lscfg -vps -l $disk|grep Z1|cut -c37-| cut -c-5`" >> asm_disk_lun_info.log
done
paste asm_info.log asm_disk_lun_info.log| awk '
BEGIN { format = "%-29s %-28s %-28s %s\n"
printf format, "ASM_groups", "ASM_Disk_PATH", "UNIX_Disk", "LUN/Device_id"
printf format, "----------", "-------------", "---------", "-------------"}
{for(i=1;i<=NF;i++)
printf("%-30s%c", $i, (i==NF) ? ORS : "")}' >> asm_info_final.log;
exit;


Hope this helps....

No comments:

Post a Comment

PostgreSql: Useful Commands-

 1)   ************************* Users ***************************  -- List of users with roles assigned: SELECT usename AS role_name,   CASE...