#!/bin/sh # # createMatrix # # Author: Todd Stansell # # This script builds a matrix file that describes disk devices. # Output is sent to standard out and is in the following form: # # # Notes: we use the last 3 digits of the Symmetrix ID to distinguish # between boxes. If this causes a problem, change it. # # $Id: createMatrix,v 1.6 2002-01-24 00:48:51-08 todd Exp $ # BASE=`basename $0` USAGE="usage: $BASE [-h][-v][-s symdev_location]" SYMDEV=/usr/symcli/bin/symdev while getopts s:vh c ; do case $c in h|?) echo "$USAGE"; exit ;; s) SYMDEV=$OPTARG ;; esac done shift `expr $OPTIND - 1` if [ ! -x $SYMDEV ] ; then echo "You must have symdev installed." exit 1 fi $SYMDEV -v list | nawk ' # Device Physical Name : /dev/rhdisk12 (GateKeeper) # # Device Symmetrix Name : 000 # Device Serial ID : N/A # Symmetrix ID : 000282503155 # ... # Back End Disk Director Information # { # Hyper Type : Data # Hyper Status : Ready (RW) # Disk [Director, Interface, TID] : [02A, C, 0] # Disk Director Volume Number : 1 # Hyper Number : 1 # Disk Capacity : 17366m # ... # } # use last 3 digits as ID# (space is part of $NF) /Symmetrix ID/ { symid=substr($4,10) } /Hyper Type/ { type=$4 } /Device Physical Name/ { if ($0 ~ /Not Visible/) name="Not_Visible" else name=$5 } # make sure hex number is all lower-case /Device Symmetrix Name/ { lun=tolower($5) } # we only want to get the info for "Data" disks /Director, Interface, TID/ && type == "Data" { FS=":" printf "%s%s\t%s\t%s\n",symid,lun,name,$NF FS=" " type="" }' | \ while read id dev dir ; do if [ "$dev" = "Not_Visible" ] ; then size="0" else size=`prtvtoc -h $dev | awk '$1=="4" {print $5}'` fi [ "$size" ] || size="no slice 4" echo "$id $dev $dir $size" done | sort | tr -d "\[] " | tr , -