[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] RAID10 and RAID6



On Fri, Jul 18, 2008 at 01:28:07PM +0200, Frans Pop wrote:
> On Thursday 17 July 2008, Ryan Niebur wrote:
> > Here is a new patch that doesn't move those functions, and makes
> > changes to the debconf templates based on Martin's comments.
> 
> Much better :-)
> 
> I've added my comments inside the patch marked with ####.
> I've snipped parts of the patch that I had no comments about, hopefully 
> leaving enough for context.
> 
> The review is mostly on style, but I did not spot anything that looked 
> obviously wrong to me. For the rest it will just need testing.
> 
> General question: how well has this been tested and for which RAID levels 
> and variations in spare/missing devices?
> 

It's well tested.
I've tested all of the raid levels with no spares/missing.
I've tested all but raid 6 with 1 spare.
I've tested raid 1 with a missing.

> Again, in general this looks very good.
> 
> Cheers,
> FJP
> 

I split the patch up like Jérémy said to.

I think I fixed all of the problems you pointed out.

This is the only thing that I didn't:

> Index: mdcfg/debian/mdcfg-utils.templates
> ===================================================================
> --- mdcfg/debian/mdcfg-utils.templates	(revision 54408)
> +++ mdcfg/debian/mdcfg-utils.templates	(working copy)
> @@ -107,6 +107,80 @@
>  
> +Template: mdcfg/raid10layout
> +Type: string
> +# :sl3:
> +_Description: Layout of the RAID10 multidisk device:
> + The layout must be n, o, or f followed by a number.
> + .
> + The number is the number of copies of each chunk.
> + It has to be equal to or smaller than the number of active devices.
> + .
> + The letter is the arrangement of the copies.
> +  n - near copies: Multiple copies of one data block are at similar offsets in different devices.
> +  f - far copies: Multiple copies have very different offsets
> +  o - offset copies: Rather than the chunks being duplicated within a stripe, whole stripes are duplicated but are rotated by one device so duplicate blocks are on different devices.
> 
> #### Don't the lines above need explicit \n at the end?

I don't think so...it worked fine for me.


-- 
_________________________
Ryan Niebur
RyanRyan52@gmail.com
From 874d773574ed7010ea5e0571c7511d34f49093a0 Mon Sep 17 00:00:00 2001
From: Ryan Niebur <RyanRyan52@gmail.com>
Date: Fri, 18 Jul 2008 12:26:33 -0700
Subject: [PATCH] reuse code

---
 packages/mdcfg/mdcfg.sh |  240 +++++++++++++----------------------------------
 1 files changed, 64 insertions(+), 176 deletions(-)

diff --git a/packages/mdcfg/mdcfg.sh b/packages/mdcfg/mdcfg.sh
index 37a1f09..a960ea1 100755
--- a/packages/mdcfg/mdcfg.sh
+++ b/packages/mdcfg/mdcfg.sh
@@ -103,12 +103,12 @@ md_createmain() {
 		fi
 
 		case "$RAID_SEL" in
-		    RAID5)
-			md_create_raid5 ;;
-		    RAID1)
-			md_create_raid1 ;;
+		    RAID5|RAID1)
+			md_create_array "$RAID_SEL" ;;
 		    RAID0)
 			md_create_raid0 ;;
+		    *)
+			return 1 ;;
 		esac
 	fi
 }
@@ -199,215 +199,94 @@ md_create_raid0() {
 		      -n $SELECTED $RAID_DEVICES
 }
 
-md_create_raid1() {
+md_create_array(){
 	OK=0
 
-	db_set mdcfg/raid1devcount 2
-
-	# Get the count of active devices
-	while [ $OK -eq 0 ]; do
-		db_input critical mdcfg/raid1devcount
-		db_go
-		if [ $? -eq 30 ]; then
-			return
-		fi
-
-		# Figure out, if the user entered a number
-		db_get mdcfg/raid1devcount
-		RET=$(echo $RET | sed -e "s/[[:space:]]//g")
-		if [ "$RET" ]; then
-			let "OK=${RET}>0 && ${RET}<99"
-		fi
-	done
-
-	db_set mdcfg/raid1sparecount "0"
-	OK=0
-
-	# Same procedure as above, but get the number of spare partitions
-	# this time.
-	# TODO: Make a general function for this kind of stuff
-	while [ $OK -eq 0 ]; do
-		db_input critical mdcfg/raid1sparecount
-		db_go
-		if [ $? -eq 30 ]; then
-			return
-		fi
-		db_get mdcfg/raid1sparecount
-		RET=$(echo $RET | sed -e "s/[[:space:]]//g")
-		if [ "$RET" ]; then
-			let "OK=${RET}>=0 && ${RET}<99"
-		fi
-	done
-
-	db_get mdcfg/raid1devcount
-	DEV_COUNT="$RET"
-	db_get mdcfg/raid1sparecount
-	SPARE_COUNT="$RET"
-	REQUIRED=$(($DEV_COUNT + $SPARE_COUNT))
-
-	db_set mdcfg/raid1devs ""
-	SELECTED=0
-
-	# Loop until at least one device has been selected
-	until [ $SELECTED -gt 0 ] && [ $SELECTED -le $DEV_COUNT ]; do
-		db_subst mdcfg/raid1devs COUNT "$DEV_COUNT"
-		db_subst mdcfg/raid1devs PARTITIONS "$PARTITIONS"
-		db_input critical mdcfg/raid1devs
-		db_go
-		if [ $? -eq 30 ]; then
-			return
-		fi
-
-		db_get mdcfg/raid1devs
-		SELECTED=0
-		for i in $RET; do
-			DEVICE=$(echo $i | sed -e "s/,//")
-			let SELECTED++
-		done
-	done
-
-	# Add "missing" for as many devices as weren't selected
-	MISSING_DEVICES=""
-	while [ $SELECTED -lt $DEV_COUNT ]; do
-		MISSING_DEVICES="$MISSING_DEVICES missing"
-		let SELECTED++
-	done
-
-	# Remove partitions selected in raid1devs from the PARTITION list
-	db_get mdcfg/raid1devs
-
-	prune_partitions "$RET"
-
-	db_set mdcfg/raid1sparedevs ""
-	SELECTED=0
-	if [ $SPARE_COUNT -gt 0 ]; then
-		FIRST=1
-		# Loop until the correct number of devices has been selected.
-		# That means any number less than or equal to the spare count.
-		while [ $SELECTED -gt $SPARE_COUNT ] || [ $FIRST -eq 1 ]; do
-			FIRST=0
-			db_subst mdcfg/raid1sparedevs COUNT "$SPARE_COUNT"
-			db_subst mdcfg/raid1sparedevs PARTITIONS "$PARTITIONS"
-			db_input critical mdcfg/raid1sparedevs
-			db_go
-			if [ $? -eq 30 ]; then
-				return
-			fi
-
-			db_get mdcfg/raid1sparedevs
-			SELECTED=0
-			for i in $RET; do
-				DEVICE=$(echo $i | sed -e "s/,//")
-				let SELECTED++
-			done
-		done
-	fi
-
-	# The number of spares the user has selected
-	NAMED_SPARES=$SELECTED
-
-	db_get mdcfg/raid1devs
-	RAID_DEVICES=$(echo $RET | sed -e "s/,//g")
-
-	db_get mdcfg/raid1sparedevs
-	SPARE_DEVICES=$(echo $RET | sed -e "s/,//g")
-
-	MISSING_SPARES=""
-
-	COUNT=$NAMED_SPARES
-	while [ $COUNT -lt $SPARE_COUNT ]; do
-		MISSING_SPARES="$MISSING_SPARES missing"
-		let COUNT++
-	done
-
-	# Find the next available md-number
-	MD_NUM=$(grep ^md /proc/mdstat | \
-		 sed -e 's/^md\(.*\) : active .*/\1/' | sort | tail -n1)
-	if [ -z "$MD_NUM" ]; then
-		MD_NUM=0
-	else
-		let MD_NUM++
-	fi
-
-	logger -t mdcfg "Selected spare count: $NAMED_SPARES"
-	logger -t mdcfg "Raid devices count: $DEV_COUNT"
-	logger -t mdcfg "Spare devices count: $SPARE_COUNT"
-	log-output -t mdcfg \
-		mdadm --create /dev/md$MD_NUM --auto=yes --force -R -l raid1 \
-		      -n $DEV_COUNT -x $SPARE_COUNT $RAID_DEVICES $MISSING_DEVICES \
-		      $SPARE_DEVICES $MISSING_SPARES
-}
+	case "$1" in
+	    RAID1)
+		MIN_SIZE=2 ;;
+	    RAID5)
+		MIN_SIZE=3 ;;
+	    *)
+		return ;;
+	esac
 
-md_create_raid5() {
-	OK=0
+	LEVEL=${1#RAID}
 
-	db_set mdcfg/raid5devcount "3"
+	db_set mdcfg/raid${LEVEL}devcount "$MIN_SIZE"
 
 	# Get the count of active devices
 	while [ $OK -eq 0 ]; do
-		db_input critical mdcfg/raid5devcount
+		db_input critical mdcfg/raid${LEVEL}devcount
 		db_go
 		if [ $? -eq 30 ]; then
 			return
 		fi
 
 		# Figure out, if the user entered a number
-		db_get mdcfg/raid5devcount
+		db_get mdcfg/raid${LEVEL}devcount
 		RET=$(echo $RET | sed -e "s/[[:space:]]//g")
 		if [ "$RET" ]; then
 			let "OK=${RET}>0 && ${RET}<99"
 		fi
 	done
 
-	db_set mdcfg/raid5sparecount "0"
+
+	db_set mdcfg/raid${LEVEL}sparecount "0"
 	OK=0
 
 	# Same procedure as above, but get the number of spare partitions
 	# this time.
 	# TODO: Make a general function for this kind of stuff
 	while [ $OK -eq 0 ]; do
-		db_input critical mdcfg/raid5sparecount
+		db_input critical mdcfg/raid${LEVEL}sparecount
 		db_go
 		if [ $? -eq 30 ]; then
 			return
 		fi
-		db_get mdcfg/raid5sparecount
+		db_get mdcfg/raid${LEVEL}sparecount
 		RET=$(echo $RET | sed -e "s/[[:space:]]//g")
 		if [ "$RET" ]; then
 			let "OK=${RET}>=0 && ${RET}<99"
 		fi
 	done
 
-	db_get mdcfg/raid5devcount
+	db_get mdcfg/raid${LEVEL}devcount
 	DEV_COUNT="$RET"
-	if [ $DEV_COUNT -lt 3 ]; then
-		DEV_COUNT=3 # Minimum number for RAID5
+	if [ $LEVEL -ne 1 ]; then
+		if [ $DEV_COUNT -lt $MIN_SIZE ]; then
+			DEV_COUNT=$MIN_SIZE # Minimum number for the selected RAID level
+		fi
 	fi
-	db_get mdcfg/raid5sparecount
+	db_get mdcfg/raid${LEVEL}sparecount
 	SPARE_COUNT="$RET"
 	REQUIRED=$(($DEV_COUNT + $SPARE_COUNT))
-	if [ $REQUIRED -gt $NUM_PART ]; then
-		db_subst mdcfg/notenoughparts NUM_PART "$NUM_PART"
-		db_subst mdcfg/notenoughparts REQUIRED "$REQUIRED"
-		db_input critical mdcfg/notenoughparts
-		db_go mdcfg/notenoughparts
-		return
+	if [ $LEVEL -ne 1 ]; then
+		if [ $REQUIRED -gt $NUM_PART ]; then
+			db_subst mdcfg/notenoughparts NUM_PART "$NUM_PART"
+			db_subst mdcfg/notenoughparts REQUIRED "$REQUIRED"
+			db_input critical mdcfg/notenoughparts
+			db_go mdcfg/notenoughparts
+			return
+		fi
 	fi
 
-	db_set mdcfg/raid5devs ""
+	db_set mdcfg/raid${LEVEL}devs ""
 	SELECTED=0
 
-	# Loop until the correct number of active devices has been selected
-	while [ $SELECTED -ne $DEV_COUNT ]; do
-		db_subst mdcfg/raid5devs COUNT "$DEV_COUNT"
-		db_subst mdcfg/raid5devs PARTITIONS "$PARTITIONS"
-		db_input critical mdcfg/raid5devs
+	# Loop until the correct number of active devices has been selected for RAID 5
+	# Loop until at least one device has been selected for RAID 1
+	until ([ $LEVEL -ne 1 ] && [ $SELECTED -eq $DEV_COUNT ]) || \
+	      ([ $LEVEL -eq 1 ] && [ $SELECTED -gt 0 ] && [ $SELECTED -le $DEV_COUNT ]); do
+		db_subst mdcfg/raid${LEVEL}devs COUNT "$DEV_COUNT"
+		db_subst mdcfg/raid${LEVEL}devs PARTITIONS "$PARTITIONS"
+		db_input critical mdcfg/raid${LEVEL}devs
 		db_go
 		if [ $? -eq 30 ]; then
 			return
 		fi
 
-		db_get mdcfg/raid5devs
+		db_get mdcfg/raid${LEVEL}devs
 		SELECTED=0
 		for i in $RET; do
 			DEVICE=$(echo $i | sed -e "s/,//")
@@ -415,12 +294,21 @@ md_create_raid5() {
 		done
 	done
 
-	# Remove partitions selected in raid5devs from the PARTITION list
-	db_get mdcfg/raid5devs
+	if [ $LEVEL -eq 1 ]; then
+		# Add "missing" for as many devices as weren't selected
+		MISSING_DEVICES=""
+		while [ $SELECTED -lt $DEV_COUNT ]; do
+			MISSING_DEVICES="$MISSING_DEVICES missing"
+			let SELECTED++
+		done
+	fi
+
+	# Remove partitions selected in raid${LEVEL}devs from the PARTITION list
+	db_get mdcfg/raid${LEVEL}devs
 
 	prune_partitions "$RET"
 
-	db_set mdcfg/raid5sparedevs ""
+	db_set mdcfg/raid${LEVEL}sparedevs ""
 	SELECTED=0
 	if [ $SPARE_COUNT -gt 0 ]; then
 		FIRST=1
@@ -428,15 +316,15 @@ md_create_raid5() {
 		# That means any number less than or equal to the spare count.
 		while [ $SELECTED -gt $SPARE_COUNT ] || [ $FIRST -eq 1 ]; do
 			FIRST=0
-			db_subst mdcfg/raid5sparedevs COUNT "$SPARE_COUNT"
-			db_subst mdcfg/raid5sparedevs PARTITIONS "$PARTITIONS"
-			db_input critical mdcfg/raid5sparedevs
+			db_subst mdcfg/raid${LEVEL}sparedevs COUNT "$SPARE_COUNT"
+			db_subst mdcfg/raid${LEVEL}sparedevs PARTITIONS "$PARTITIONS"
+			db_input critical mdcfg/raid${LEVEL}sparedevs
 			db_go
 			if [ $? -eq 30 ]; then
 				return
 			fi
 
-			db_get mdcfg/raid5sparedevs
+			db_get mdcfg/raid${LEVEL}sparedevs
 			SELECTED=0
 			for i in $RET; do
 				DEVICE=$(echo $i | sed -e "s/,//")
@@ -448,10 +336,10 @@ md_create_raid5() {
 	# The number of spares the user has selected
 	NAMED_SPARES=$SELECTED
 
-	db_get mdcfg/raid5devs
+	db_get mdcfg/raid${LEVEL}devs
 	RAID_DEVICES=$(echo $RET | sed -e "s/,//g")
 
-	db_get mdcfg/raid5sparedevs
+	db_get mdcfg/raid${LEVEL}sparedevs
 	SPARE_DEVICES=$(echo $RET | sed -e "s/,//g")
 
 	MISSING_SPARES=""
@@ -475,9 +363,9 @@ md_create_raid5() {
 	logger -t mdcfg "Raid devices count: $DEV_COUNT"
 	logger -t mdcfg "Spare devices count: $SPARE_COUNT"
 	log-output -t mdcfg \
-		mdadm --create /dev/md$MD_NUM --auto=yes --force -R -l raid5 \
+		mdadm --create /dev/md$MD_NUM --auto=yes --force -R -l raid${LEVEL} \
 		      -n $DEV_COUNT -x $SPARE_COUNT $RAID_DEVICES \
-		      $SPARE_DEVICES $MISSING_SPARES
+		      $MISSING_DEVICES $SPARE_DEVICES $MISSING_SPARES
 }
 
 md_mainmenu() {
-- 
1.5.6.2

From 2c741e8fb79a5ccb32650da7611d9a1df5dc29c0 Mon Sep 17 00:00:00 2001
From: Ryan Niebur <RyanRyan52@gmail.com>
Date: Fri, 18 Jul 2008 13:29:32 -0700
Subject: [PATCH] raid 10 and raid 6

---
 packages/kernel/kernel-wedge/modules/md-modules |    1 +
 packages/mdcfg/debian/mdcfg-utils.templates     |   96 ++++++++++++++++++++++-
 packages/mdcfg/mdcfg.sh                         |   30 ++++++-
 packages/partman/partman-auto-raid/auto-raidcfg |    7 +-
 packages/partman/partman-base/lib/base.sh       |    2 +-
 5 files changed, 128 insertions(+), 8 deletions(-)

diff --git a/packages/kernel/kernel-wedge/modules/md-modules b/packages/kernel/kernel-wedge/modules/md-modules
index cf8921c..f1c165a 100644
--- a/packages/kernel/kernel-wedge/modules/md-modules
+++ b/packages/kernel/kernel-wedge/modules/md-modules
@@ -8,6 +8,7 @@ raid0
 raid1
 raid5 ?
 raid456 ?
+raid10
 xor
 dm-mirror ?
 dm-snapshot ?
diff --git a/packages/mdcfg/debian/mdcfg-utils.templates b/packages/mdcfg/debian/mdcfg-utils.templates
index ddd9e65..b9b48f2 100644
--- a/packages/mdcfg/debian/mdcfg-utils.templates
+++ b/packages/mdcfg/debian/mdcfg-utils.templates
@@ -47,7 +47,7 @@ Template: mdcfg/createmain
 Type: select
 # :sl3:
 # flag:translate:4
-__Choices: RAID0, RAID1, RAID5, Cancel
+__Choices: RAID0, RAID1, RAID5, RAID6, RAID10, Cancel
 # :sl3:
 _Description: Multidisk device type:
  Please choose the type of the multidisk device to be created.
@@ -107,6 +107,80 @@ _Description: Spare devices for the RAID5 multidisk device:
  devices, the remaining partitions will be added to the array as "missing".
  You will be able to add them later to the array.
 
+Template: mdcfg/raid6devcount
+Type: string
+# :sl3:
+_Description: Number of active devices for the RAID6 array:
+ The RAID6 array will consist of both active and spare partitions. The active
+ partitions are those used, while the spare devices will only be used if one or
+ more of the active devices fail. A minimum of four active devices is
+ required.
+ .
+ NOTE: this setting cannot be changed later.
+
+Template: mdcfg/raid6sparecount
+Type: string
+# :sl3:
+_Description: Number of spare devices for the RAID6 array:
+
+Template: mdcfg/raid6sparedevs
+Type: multiselect
+Choices: ${PARTITIONS}
+# :sl3:
+_Description: Spare devices for the RAID6 multidisk device:
+ You have chosen to create an RAID6 array with ${COUNT} spare devices.
+ .
+ Please choose which partitions will be used as spare devices.
+ You may choose up to ${COUNT} partitions. If you choose less than ${COUNT}
+ devices, the remaining partitions will be added to the array as "missing".
+ You will be able to add them later to the array.
+
+Template: mdcfg/raid10layout
+Type: string
+# :sl3:
+_Description: Layout of the RAID10 multidisk device:
+ The layout must be n, o, or f followed by a number.
+ .
+ The number is the number of copies of each chunk.
+ It has to be equal to or smaller than the number of active devices.
+ .
+ The letter is the arrangement of the copies.
+  n - near copies: Multiple copies of one data block are at similar offsets in different devices.
+  f - far copies: Multiple copies have very different offsets
+  o - offset copies: Rather than the chunks being duplicated within a stripe, whole stripes are duplicated but are rotated by one device so duplicate blocks are on different devices.
+ .
+ The default setting is n2.
+ .
+ NOTE: this setting cannot be changed later.
+
+Template: mdcfg/raid10devcount
+Type: string
+# :sl3:
+_Description: Number of active devices for the RAID10 array:
+ The RAID10 array will consist of both active and spare partitions. The active
+ partitions are those used, while the spare devices will only be used if one or
+ more of the active devices fail. A minimum of two active devices is
+ required.
+ .
+ NOTE: this setting cannot be changed later.
+
+Template: mdcfg/raid10sparecount
+Type: string
+# :sl3:
+_Description: Number of spare devices for the RAID10 array:
+
+Template: mdcfg/raid10sparedevs
+Type: multiselect
+Choices: ${PARTITIONS}
+# :sl3:
+_Description: Spare devices for the RAID10 multidisk device:
+ You have chosen to create an RAID10 array with ${COUNT} spare devices.
+ .
+ Please choose which partitions will be used as spare devices.
+ You may choose up to ${COUNT} partitions. If you choose less than ${COUNT}
+ devices, the remaining partitions will be added to the array as "missing".
+ You will be able to add them later to the array.
+
 Template: mdcfg/raid0devs
 Type: multiselect
 Choices: ${PARTITIONS}
@@ -135,6 +209,26 @@ _Description: Active devices for the RAID5 multidisk device:
  Please choose which partitions are active devices.
  You must select exactly ${COUNT} partitions.
 
+Template: mdcfg/raid6devs
+Type: multiselect
+Choices: ${PARTITIONS}
+# :sl3:
+_Description: Active devices for the RAID6 multidisk device:
+ You have chosen to create an RAID6 array with ${COUNT} active devices.
+ .
+ Please choose which partitions are active devices.
+ You must select exactly ${COUNT} partitions.
+
+Template: mdcfg/raid10devs
+Type: multiselect
+Choices: ${PARTITIONS}
+# :sl3:
+_Description: Active devices for the RAID10 multidisk device:
+ You have chosen to create an RAID10 array with ${COUNT} active devices.
+ .
+ Please choose which partitions are active devices.
+ You must select exactly ${COUNT} partitions.
+
 Template: mdcfg/deletemenu
 Type: select
 # :sl3:
diff --git a/packages/mdcfg/mdcfg.sh b/packages/mdcfg/mdcfg.sh
index a960ea1..d299c66 100755
--- a/packages/mdcfg/mdcfg.sh
+++ b/packages/mdcfg/mdcfg.sh
@@ -103,7 +103,7 @@ md_createmain() {
 		fi
 
 		case "$RAID_SEL" in
-		    RAID5|RAID1)
+		    RAID10|RAID6|RAID5|RAID1)
 			md_create_array "$RAID_SEL" ;;
 		    RAID0)
 			md_create_raid0 ;;
@@ -207,6 +207,10 @@ md_create_array(){
 		MIN_SIZE=2 ;;
 	    RAID5)
 		MIN_SIZE=3 ;;
+	    RAID6)
+		MIN_SIZE=4 ;;
+	    RAID10)
+		MIN_SIZE=2 ;;
 	    *)
 		return ;;
 	esac
@@ -274,7 +278,7 @@ md_create_array(){
 	db_set mdcfg/raid${LEVEL}devs ""
 	SELECTED=0
 
-	# Loop until the correct number of active devices has been selected for RAID 5
+	# Loop until the correct number of active devices has been selected for RAID 5, 6, and 10
 	# Loop until at least one device has been selected for RAID 1
 	until ([ $LEVEL -ne 1 ] && [ $SELECTED -eq $DEV_COUNT ]) || \
 	      ([ $LEVEL -eq 1 ] && [ $SELECTED -gt 0 ] && [ $SELECTED -le $DEV_COUNT ]); do
@@ -333,6 +337,22 @@ md_create_array(){
 		done
 	fi
 
+	if [ $LEVEL -eq 10 ]; then
+		OK=0
+		db_set mdcfg/raid10layout "n2"
+		while [ $OK -eq 0 ]; do
+			db_input low mdcfg/raid10layout
+			db_go
+			if [ $? -eq 30 ]; then return; fi
+			db_get mdcfg/raid10layout
+			if echo $RET | grep -Eq "^[nfo][0-9]{1,2}$" && \
+			    [ $(echo $RET | sed s/.//) -le $DEV_COUNT ]; then
+				OK=1
+			fi
+		done
+		LAYOUT="--layout=$RET"
+	fi
+
 	# The number of spares the user has selected
 	NAMED_SPARES=$SELECTED
 
@@ -363,9 +383,10 @@ md_create_array(){
 	logger -t mdcfg "Raid devices count: $DEV_COUNT"
 	logger -t mdcfg "Spare devices count: $SPARE_COUNT"
 	log-output -t mdcfg \
-		mdadm --create /dev/md$MD_NUM --auto=yes --force -R -l raid${LEVEL} \
+		mdadm --create /dev/md$MD_NUM --auto=yes --force -R -l raid${LEVEL} $LAYOUT \
 		      -n $DEV_COUNT -x $SPARE_COUNT $RAID_DEVICES \
 		      $MISSING_DEVICES $SPARE_DEVICES $MISSING_SPARES
+	unset LAYOUT MISSING_DEVICES
 }
 
 md_mainmenu() {
@@ -391,11 +412,12 @@ md_mainmenu() {
 ### Main of script ###
 
 # Try to load the necesarry modules.
-# Supported schemes: RAID 0, RAID 1, RAID 5
+# Supported schemes: RAID 0, RAID 1, RAID 5, RAID 6, RAID 10
 depmod -a >/dev/null 2>&1
 modprobe md >/dev/null 2>&1 || modprobe md-mod >/dev/null 2>&1
 modprobe raid0 >/dev/null 2>&1
 modprobe raid1 >/dev/null 2>&1
+modprobe raid10 >/dev/null 2>&1
 # kernels >=2.6.18 have raid456
 modprobe raid456 >/dev/null 2>&1 || modprobe raid5 >/dev/null 2>&1
 
diff --git a/packages/partman/partman-auto-raid/auto-raidcfg b/packages/partman/partman-auto-raid/auto-raidcfg
index e91e182..fe77023 100755
--- a/packages/partman/partman-auto-raid/auto-raidcfg
+++ b/packages/partman/partman-auto-raid/auto-raidcfg
@@ -8,7 +8,9 @@ create_raid() {
 	RAID_TYPE="$1"
 	DEV_COUNT="$2"
 
-	if [ "$DEV_COUNT" -lt 3 ] && [ $RAID_TYPE = "5" ] ; then
+	if ([ "$DEV_COUNT" -lt 3 ] && [ $RAID_TYPE = "5" ]) ||
+	   ([ "$DEV_COUNT" -lt 4 ] && [ $RAID_TYPE = "6" ]) ||
+	   ([ "$DEV_COUNT" -lt 2 ] && [ $RAID_TYPE = "10" ]); then
 		db_input critical partman-auto-raid/notenoughparts
 		db_go partman-auto-raid/notenoughparts
 		exit 9
@@ -82,11 +84,12 @@ create_raid() {
 }
 
 # Try to load the necessary modules.
-# Supported schemes: RAID 0, RAID 1, RAID 5
+# Supported schemes: RAID 0, RAID 1, RAID 5, RAID 6, RAID 10
 depmod -a 1>/dev/null 2>&1
 modprobe md 1>/dev/null 2>&1 || modprobe md-mod 1>/dev/null 2>&1
 modprobe raid0 >/dev/null 2>&1
 modprobe raid1 1>/dev/null 2>&1
+modprobe raid10 1>/dev/null 2>&1
 # kernels >=2.6.18 have raid456
 modprobe raid456 >/dev/null 2>&1 || modprobe raid5 >/dev/null 2>&1
 mkdir -p /dev/md
diff --git a/packages/partman/partman-base/lib/base.sh b/packages/partman/partman-base/lib/base.sh
index 91540f4..f10a62f 100644
--- a/packages/partman/partman-base/lib/base.sh
+++ b/packages/partman/partman-base/lib/base.sh
@@ -728,7 +728,7 @@ humandev () {
 	    ;;
 	/dev/md*|/dev/md/*)
 	    device=`echo "$1" | sed -e "s/.*md\/\?\(.*\)/\1/"`
-	    type=`grep "^md${device}[ :]" /proc/mdstat | sed -e "s/^.* : active raid\([[:alnum:]]\).*/\1/"`
+	    type=`grep "^md${device}[ :]" /proc/mdstat | sed -e "s/^.* : active raid\([[:alnum:]]\{,2\}\).*/\1/"`
 	    db_metaget partman/text/raid_device description
 	    printf "$RET" ${type} ${device}
 	    ;;
-- 
1.5.6.2

Attachment: signature.asc
Description: Digital signature


Reply to: