Re: disk map script

From: Frank Chiavoni (Frank.Chiavoni_at_OIT.STATE.NJ.US)
Date: 01/08/04

  • Next message: John Jolet: "Re: how to make an identical copy of the raw device from one hdisk to another ?"
    Date:         Thu, 8 Jan 2004 10:20:02 -0500
    To: aix-l@Princeton.EDU
    
    

    Bill,

    If you want color put it on a web page. Could have chosen better
    colors...

    Create html - mdiskmap.sh > mdiskmap.html

    #!/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"
    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
    Codes</b></td></tr>"
       echo "$key</table>"

    done

    echo "</body></html>"

    exit 0

    -----Original Message-----
    From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU]On Behalf Of
    Bill Verzal
    Sent: Wednesday, January 07, 2004 3:20 PM
    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

    ..........


  • Next message: John Jolet: "Re: how to make an identical copy of the raw device from one hdisk to another ?"

    Relevant Pages

    • Re: disk map script
      ... Subject: disk map script ... This script will create a report on how individual hdisks are allocated ... I usually use Excel to create color-coded ones, ...
      (AIX-L)
    • Re: disk map script
      ... echo "Please specify one or more hdisks" ... Subject: disk map script ... This is a functional version of the script, ... I usually use Excel to create color-coded ones, ...
      (AIX-L)
    • Re: disk map script
      ... AIX Administrator, Komatsu America ... Subject: disk map script ... This script will create a report on how individual hdisks are allocated ...
      (AIX-L)
    • disk map script
      ... This script will create a report on how individual hdisks are allocated by ... # Create a disk map of PP's and display on screen. ...
      (AIX-L)