Changeset 3016 in MondoRescue for branches/3.0/mindi
- Timestamp:
- Jun 3, 2012, 1:52:28 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mindi/analyze-my-lvm
r3001 r3016 13 13 GetValueFromField() { 14 14 local res 15 sed s/' '/~/ "$1" | tr -s ' ' ' ' | sed s/'~ '/'~'/ | grep -i "$2~" | cut -d'~' -f2,3,4,5 | tr '~' ' ' | gawk '{ if ($2=="MB") {printf "%dm",$1;} else if ($2=="MiB") {printf "%dm",$1;} else if ($2=="KB") {printf "%dk",$1;} else if ($2=="KiB") {printf "%dk",$1;} else if ($2=="GB") {printf "%fg",$1;} else if ($2=="GiB") {printf "%fg",$1;} else if ($2=="TB") {printf "%dt",$1;} else if ($2=="TiB") {printf "%dt",$1;} else {print $0;};}'15 grep -i "$2" "$1" | perl -pi -e 's/\s*(.*)\s\s\s+(.+)$/$2/;s/\sT[i]*B/t/;s/\sG[i]*B/g/;s/\sM[i]*B/m/;s/\sK[i]*B/k/' 16 16 } 17 17 … … 84 84 device=$1 85 85 output="" 86 $LVMCMD lvdisplay $device > $fname86 $LVMCMD lvdisplay $device | cat > $fname 87 87 stripes=`GetValueFromField $fname "Stripes"` 88 88 stripesize=`GetValueFromField $fname "Stripe size (MByte)"`m … … 90 90 [ "$stripesize" = "k" ] && stripesize="" 91 91 allocation=`GetValueFromField $fname "LV Size"` 92 [ ! "`echo "$allocation" | grep "[k,m,g ]"`" ] && allocation="$allocation"m92 [ ! "`echo "$allocation" | grep "[k,m,g,t]"`" ] && allocation="$allocation"m 93 93 if echo "$allocation" | grep -E '^.*g$' > /dev/null 2> /dev/null ; then 94 94 val=`echo "$allocation" | sed s/g//` … … 124 124 rm -f $VG_info_file 125 125 } 126 127 128 126 129 127
Note:
See TracChangeset
for help on using the changeset viewer.