2011-12-04

HP-UX disk info

HP-UX seems to be shy about telling info about LUNs in an ioscan.
This little script show WWID and size of all the LUNs known to a system.

scsimgr -v get_info all_lun | awk '      \
/STATUS INFORM/ { buffer = $6" " }       \
/internal stat/ { buffer = buffer$6" " } \
/WWID/          { buffer = buffer$6" " } \
/Vendor/        { buffer = buffer$4" " } \
/Product id/    { buffer = buffer$4" " } \
/Capacity/      { blocks = $7 }          \
/size in byt/   { bsize = $6 ; giga = blocks * bsize / 1073741824 ; buffer = buffer" "giga"GB" ; print buffer } \
'

It's too bad scsimgr in releases before 11.31 works differently.
In older machines, we need to extract info from ioscan and process them with diskinfo.

for i in $(ioscan -nfkC disk | grep rdsk | awk '{ print $2 }')
do
        print -n $i
        diskinfo $i | awk '              \
BEGIN           { buffer = " " }         \
/vendor/        { buffer = buffer$2" " } \
/product/       { buffer = buffer$3 }    \
/size/          { giga = $2 / 1048576 ; buffer = buffer" "giga"GB" } \
END             { print buffer }         \
'
done

No comments:

Post a Comment