From: Bill Verzal (BVerzal@KOMATSUNA.COM)
Date: Thu Jan 08 2004 - 08:51:36 EST
Feel free to do as you wish.
--------------------------------------------------------
"If everything is coming your way, then you are in the wrong lane"
Bill Verzal
AIX Administrator, Komatsu America
(847) 970-3726 - direct
(847) 970-4184 - fax
Spencer Johnson
<Spencer.Johnson@
2020LOG.COM> To
Sent by: IBM AIX aix-l@Princeton.EDU
Discussion List cc
<aix-l@Princeton.
EDU> Subject
Re: disk map script
01/07/2004 06:10
PM
Please respond to
IBM AIX
Discussion List
<aix-l@Princeton.
EDU>
Cheers Bill.
Had a quick look and for easy reference is very good - eliminates the
Excel spreadsheet definitely
Have a look at my post in return for AIX Control Book. - Maybe I should
incorporate your script into it??
Regards
Spencer Johnson
Caudwell Distribution Group
-----Original Message-----
From: Bill Verzal [mailto:BVerzal@KOMATSUNA.COM]
Sent: 07 January 2004 20:20
To: aix-l@Princeton.EDU
Subject: disk map script
I don't know if anyone has something like this already, but I threw this
together today. This is a functional version of the script, but very
simple.
This script will create a report on how individual hdisks are allocated
by
physical partitions. I usually use Excel to create color-coded ones,
but
they require alot of manual time filling in boxes with different colors.
Feel free to pass this script on and modify it as you wish!
BV
sap80i:/usr/local/bin >cat mkdiskmap.ksh
#!/bin/ksh
#
# Create a disk map of PP's and display on screen.
# Simulates the manual labour performed to create
# the same map in Excel.
#
# Check command line args
#
if [ "$#" -eq "0" ] ; then
echo "Please specify one or more hdisks"
exit 1
fi
#
i01=" 1 2 3 4 5 6"
i02="123456789012345678901234567890123456789012345678901234567890"
i03="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#
# row 1 = 1-60
# row 2 = 61-120
# and so on
#
# Create an array of single characters for display purposes
#
charsInArray=`echo "$i03"|wc -c|awk {'print $1'}`
charsInArray=`expr $charsInArray - 1`
arrayCNT=1
while : ; do
if [ "$arrayCNT" -gt "$charsInArray" ] ; then
break
fi
charArray[${arrayCNT}]=`echo "$i03"|cut -c ${arrayCNT}`
arrayCNT=`expr $arrayCNT + 1`
done
hdisks="$@"
for hdisk in $hdisks ; do
if [ ! -r /dev/${hdisk} ] ; then
echo "Invalid disk ($hdisk) specified - skipping"
continue
fi
echo "Partition map for $hdisk:"
totalPPs=`lspv $hdisk|grep TOTAL|awk {'print $3'}`
echo "$totalPPs PPS total on disk"
x=0
while [ "$x" -le "$totalPPs" ] ; do
ppArray[${x}]="."
x=`expr $x + 1`
done
LVs1=`lspv -l $hdisk|awk {'print $1'}`
LVsCount=`echo "$LVs1"|wc|awk {'print $1'}`
LVsCount2=`expr $LVsCount - 2`
LVs2=`echo "$LVs1"|tail -$LVsCount2`
charcounter=0
key="Unused: .\n"
for LV in $LVs2 ; do
charcounter=`expr $charcounter + 1`
LVChar="${charArray[${charcounter}]}"
key="${key}${LV}: $LVChar\n"
for pp in `lslv -m $LV|grep -v LP|awk {'print $2'}` ; do
ppArray[${pp}]="$LVChar"
done
done
echo "$i01"
echo "$i02"
a=1
b=1
while [ "$a" -le "$totalPPs" ] ; do
echo "${ppArray[${a}]}\c"
a=`expr $a + 1`
b=`expr $b + 1`
if [ "$b" -gt "60" ] ; then
echo " "
b=1
fi
done
echo "\n"
echo "$key"
done
exit 0
============== Sample output below ==============
sap80i:/usr/local/bin >mkdiskmap.ksh hdisk1
Partition map for hdisk1:
542 PPS total on disk
1 2 3 4 5 6
123456789012345678901234567890123456789012345678901234567890
AIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIBBBBBJJJJCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFGG
GGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
HHHHHHHHHHHHHHHHHHHHHHHHHDDDDDDDDDDDDDDDDDCCCCCCCHHHHHHHHHHH
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
HHHHHHHHHHHHH...............................................
..............................JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
JJ
Unused: .
hd5: A
hd10opt: B
hd3: C
hd9var: D
hd6: E
hd8: F
hd4: G
hd2: H
hd1: I
lbin: J
Enjoy!
Bill.
--------------------------------------------------------
"If everything is coming your way, then you are in the wrong lane"
Bill Verzal
AIX Administrator, Komatsu America
(847) 970-3726 - direct
(847) 970-4184 - fax
***************************************************************
Disclaimer :-
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions are solely
those of the author and do not necessarily represent those of
20:20 Logistics Ltd, Dextra Solutions Ltd, The Discovery Store Ltd,
The Mobile Phone Repair Company Ltd and Caudwell Group.
If you are not the intended recipient, be advised that you have
received this email in error and that any use, dissemination,
forwarding, printing or copying is strictly prohibited. If you
have received this email in error please delete it from your system
and notify the sender immediately.
***************************************************************
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:28 EDT