Skip to content

Commit

Permalink
layout: add code to fix "layout" of RAID10
Browse files Browse the repository at this point in the history
Unable to create an array that outputs "near=2,far=1", only tested with "near=2".
  • Loading branch information
jhoekx committed May 24, 2011
1 parent 163b747 commit 4dbbb28
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions usr/share/rear/layout/save/GNU/Linux/21_raid_layout.sh
Expand Up @@ -17,6 +17,21 @@ if [ -e /proc/mdstat ] && grep -q blocks /proc/mdstat ; then
layout=$( grep "Layout" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2")
chunksize=$( grep "Chunk Size" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2" | sed -r 's/^([0-9]+).+/\1/')

# fix up layout for RAID10:
# > near=2,far=1 -> n2
if [ "$level" = "raid10" ] ; then
OIFS=$IFS
IFS=","
for param in "$layout" ; do
copies=${layout%=*}
number=${layout#*=}
if [ "$number" -gt 1 ] ; then
layout="${copies:0:1}$number"
fi
done
IFS=$OIFS
fi

ndevices=$( grep "Raid Devices" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2")
totaldevices=$( grep "Total Devices" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2")
let sparedevices=$totaldevices-$ndevices
Expand Down

0 comments on commit 4dbbb28

Please sign in to comment.