[olug] Multipath, multi-arrays, and correlation.
Jay Swackhamer
Jay at RebootTheUser.com
Fri Jul 20 18:31:58 UTC 2007
I could find a complete script with all of the info I needed, so I
wrote the following script to print out:
sd-device | dm-device | mpath | Array model | volume group | size |
serial number | device number
output sample:
sdff | dm-37 | mpath55 | 2107900 | none |
19531264 | 75L86111189 | 130:16
sdfg | dm-26 | mpath8 | HSV210 | vg02 |
744488960 | P8398F4AAT2010 | 130:32
Can be downloaded from: http://downloads.reboottheuser.com/linux/lpvinfo
user:movies passwd:video
Script:
#
#AUTHOR="Jay Swackhamer"
#
WORK=/tmp/diskinfo
mkdir ${WORK}
MPATH_LIST=`ls /dev/mpath | grep mpath | grep -v p1 `
for i in ${MPATH_LIST}
do
multipath -l ${i} > ${WORK}/$i.txt
done
cd /sys/block
SD_LIST=`ls | grep sd`
for i in ${SD_LIST}
do
MODEL=`cat ${i}/device/model`
SIZE=`cat ${i}/size`
MPATH=`grep "${i} " ${WORK}/* | awk ' { print $1 } ' | sed -e
's/\// /g' -e 's/://g' -e 's/.txt//g' | awk ' { print $3 } '`
DM_DEV=`ls -altr /dev/mpath/${MPATH} | awk ' { print $11 } ' | sed
-e 's/..\///g'`
DM_NUM=`echo ${MPATH} | sed -e 's/mpath//g'`
VG=`pvdisplay /dev/dm-${DM_NUM} 2>&1 | grep "VG Name" | awk ' {
print $3 } ' `
if [ "${VG}" = "" ];then
VG='none'
fi
SERIAL_NUM=`/sbin/scsi_id -g -p 0x80 -s /block/${i} | awk ' { print $3 } '`
DEV=`cat ${i}/dev`
STRING="${i}+${DM_DEV}+${MPATH}+${MODEL}+${VG}+${SIZE}+${SERIAL_NUM}+${DEV}"
echo "${STRING}" | awk -F+ ' { printf "%-10s | %-10s | %-10s |
%-10s | %-10s | %-10s | %-15s | %-10s\n", $1, $2, $3, $4, $5, $6, $7,
$8 } '
done
rm -fr ${WORK}
--
Jay Swackhamer
Reboot The User
13416 A Street
Omaha, NE 68144
402-933-6449
Hours: 6pm-11pm Tues-Fri, 4pm-9pm Sat.
http://www.reboottheuser.com
http://www.cafepress.com/rtu
More information about the OLUG
mailing list