Ignore:
Timestamp:
Aug 28, 2015, 2:34:47 AM (4 years ago)
Author:
Bruno Cornec
Message:
  • Change analyze-my-lvm in order to generate percentage of Extents of a VG to use to create the LV instead of a fixed size. Should improve bugs when creating LVM on a disk of different size greatly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi/analyze-my-lvm

    r3312 r3432  
    8282    local device stripes stripesize device fname allocation output readahead
    8383    fname=$MINDI_TMP/PLF.$$.txt
     84    fname2=$MINDI_TMP/PLF2.$$.txt
    8485    device=$1
    8586    output=""
     
    8990    [ "$stripesize" = "m" ] && stripesize=`GetValueFromField $fname "Stripe size (KByte)"`k
    9091    [ "$stripesize" = "k" ] && stripesize=""
    91     allocation=`GetValueFromField $fname "LV Size"`
    92     [ ! "`echo "$allocation" | grep "[k,m,g,t]"`" ] && allocation="$allocation"m
    93     if echo "$allocation" | grep -E '^.*g$' > /dev/null 2> /dev/null ; then
    94         val=`echo "$allocation" | sed s/g//`
    95         allocation=`echo "$val" | awk '{c=$1; printf "%d", c*1024;}'`m
    96     fi
     92    currentLE=`GetValueFromField $fname "Current LE"`
     93    vgname=`GetValueFromField $fname "VG Name"`
     94    $LVMCMD vgdisplay $vgname | cat > $fname2
     95    totalLE=`GetValueFromField $fname2 "Total PE"`
     96    allocation=`perl -e '$per='$currentLE'*100/'$totalLE' ; print int($per+0.5)."%VG";'`
    9797    readahead=`GetValueFromField $fname "Read ahead sectors"`
    98     rm -f $fname
     98    rm -f $fname $fname2
    9999    [ "$stripes" ]    && output="$output -i $stripes"
    100100    [ "$stripesize" ] && output="$output -I $stripesize"
    101     [ "$allocation" ] && output="$output -L $allocation"
     101    [ "$allocation" ] && output="$output -l $allocation"
    102102    [ "$readahead" ]  && output="$output -r $readahead"
    103103    echo "$output"
Note: See TracChangeset for help on using the changeset viewer.