#!/usr/bin/ksh
PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ucb:/usr/proc/bin:/usr/platform/SUNW,Sun-Fire-15000/sbin:/etc/vx/bin:/usr/local/bin:/usr/local/sbin:/usr/storapi/bin
# list the character devices in the given EMC device groups
[[ $# -lt 1 ]] && echo "[FATAL]Must give one or more EMC device groups" && exit 1
[[ $(uname -s) != 'SunOS' ]] && echo "[FATAL]Only works on Solaris" && exit 1
# show the emc device names that correspond to each of the devices in an EMC device group
dev_groups="$@"
# work through the given EMC device groups
for _dev_group in $dev_groups
do
# save the Symmetrix ID of the device group so that we get the right disks later
_sym_enc_id=$(symdg show $_dev_group | grep 'Symmetrix ID' | awk '{print $NF}')
for _sym_dev in $(symdg show $_dev_group | grep 'DEV[0-9]' | awk '{print $3}')
do
# find the disks with both device id and Symmetrix ID that match.
for _rdev in $(syminq -symmids | nawk -v sd=$_sym_dev -v se=$_sym_enc_id '{if (NF>3 && match($(NF-1), "[0-9A-E][0-9A-E][0-9A-E]"sd"[0-9A-E][0-9A-E][0-9A-E]") && $(NF-3) == se ) {print $1; exit}}')
do
_base_dev=${_rdev##*/} # basename $_rdev
_emc_path=$(vxdisk path | grep $_base_dev | awk '{print $2}')
echo $_dev_group $_sym_enc_id $_sym_dev $_emc_path
done
done
done
Friday, July 11, 2008
find the EBN names for EMC devices in a device group
This script will list all the EBN (Veritas enclosure based names) for the disks in the named EMC device group
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment