×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Disk and filesystem management

Create a colored disk map by filesystem by bjverzal
Posted: 12 Jan 04 (Edited 9 Feb 04)

Run this script and redirect the output to an HTML file.

#!/bin/ksh
#
# Create a HTML disk map of PP's
# Simulates the manual labour performed to create
# the same map in Excel.
#
# Original created 1/7/2004 by Bill Verzal (bjverzal@yahoo.com)
#
# For best results, redirect output to a .htm/.html file.
#
# This version modified from original by
# Frank Chiavoni <Frank.Chiavoni@OIT.STATE.NJ.US>
#
#
# 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"
colors="#f2c8d0 #2d970b #2e0c7f #6b8a76 #45c53a #37dfb1 #b49618  #0507d6 #32525f #b42363 #84ed57 #c359b7 #103660 #45ec3d #324565  #940964 #51b538"

#
# row 1 = 1-60
# row 2 = 61-120
# and so on
#
# Create an array of single characters for display purposes
#

arrayCNT=1
for colour in $colors
do
        colorArray[${arrayCNT}]=$colour
        arrayCNT=`expr $arrayCNT + 1`
done

hdisks="$@"
echo "<html><head><title>mdiskmap</title></head><body>"

for hdisk in $hdisks ; do

##Didn't run as root so removed...
   if [ ! -r /dev/${hdisk} ] ; then
        :
      ##echo "Invalid disk ($hdisk) specified - skipping"
      ##continue
   fi

   echo "<font size=3 color=red><b>Partition map for
$hdisk:</b></font><br>"
   totalPPs=`lspv $hdisk|grep TOTAL|awk {'print $3'}`
   echo "<font size=3 color=red>$totalPPs PPS total on disk</font><p>"
   x=0

   defaultColor="#f7f2fd"
   while [ "$x" -le "$totalPPs" ] ; do
      ppArray[${x}]=$defaultColor
      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="<tr><td><font><b><i>Unused</i></b></font></td><td
bgcolor=\"${defaultColor}\"><font
color=\"${defaultColor}\">X....X</font></td></tr>"

   for LV in $LVs2 ; do

      charcounter=`expr $charcounter + 1`
      LVColor="${colorArray[${charcounter}]}"
      key="${key}<tr><td><font><b><i>${LV}</i></b></font></td><td
bgcolor=\"${LVColor}\"><font color=\"${LVColor}\">X</font></td></tr>"

      for pp in `lslv -m $LV|grep -v LP|awk {'print $2'}` ; do
         ppArray[${pp}]="$LVColor"
      done

   done

   echo "<table><tr>"

   a=1
   b=1
   while [ "$a" -le "$totalPPs" ] ; do
      echo "<td bgcolor=\"${ppArray[${a}]}\"><font
color=\"${ppArray[${a}]}\">X</font></td>"
      a=`expr $a + 1`
      b=`expr $b + 1`
      if [ "$b" -gt "60" ] ; then
         echo "</tr>"
         b=1
      fi
   done

   echo "</tr></table>"

   echo "<p><p><table><tr><td colspan=2><font color=red><b>Color"
   echo "$key</table>"

done

echo "</body></html>"

exit 0

Then view the created HTML file in your browser of choice.  Feel free to change and distribute.

Bill.

Back to IBM: AIX FAQ Index
Back to IBM: AIX Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close