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

[RFC] Some love for partman-md v3



On Mon, Jun 02, 2008 at 10:33:17AM +0200, Frans Pop wrote:
> On Monday 02 June 2008, Jérémy Bobbio wrote:
> You're still modprobing the raid* modules in init.d/md-devices. IMO it's 
> not correct to unnecessarily start using memory for these for installs 
> that may not use RAID at all.

Indeed.  Neither detection of existing devices nor creation of new
devices need manual loading of the raid* modules.  It has been removed
in both mdcfg and init.d/md-devices.

> +++ b/packages/partman/partman-md/init.d/md-devices
> +log-output -t md-init --pass-stdout \
> +	mdadm --examine --scan --config=partitions >/tmp/mdadm.conf
> +log-output -t md-init \
> +	mdadm --assemble --scan --run --config=/tmp/mdadm.conf --auto=yes
> 
> Should be 'log-output -t partman-md'.

Fixed.

Two others changes in this new version of the patch:

 * lib/disk-label.sh now clean up MD devices in create_disk_label() 

   As MD devices are now activated during partman initialization, any
   autopartitioning on entire disks fails if they are not deactivated
   before.  The same approach as the one used for LVM has been used:
   partman-md provides a lib/md-remove.sh that is used when available.
 
 * init.d/md has been moved before init.d/lvm

   As "LVM on RAID" setups seems a lot more useful as "RAID on LVM", we
   first detect RAID devices, and then proceed to LVM detection.
   Please note that Volume Groups are not activated by default and need
   manual activation after selecting "Configure logical volume".

   Two questions popped up in my mind after this change:
     * Would it be desirable to activate Volume Groups by default, like
       it would now be done for RAID devices?
     * How are we going to cope with really twisted setups if we ever
       fix #451535?

Comments welcome, as usual. :)

Cheers,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
commit cec81569d3642486bd6590fb7a02fe0940763d94
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Thu May 29 16:12:16 2008 +0000

    Clean up the initialization of MD devices
    
    The initialization of MD devices in partman previously diverged from what
    others partman components are doing, resulting in quite few bugs and
    really bad interactions with crypto setup.
    
     * Scanning for existing MD devices
    
       During partman initialization, the init.d/md-devices script now load
       kernel modules and scan for MD devices the first time it is started.
    
       This script has been moved to be called before init.d/parted to have
       existing RAID partitions listed on the first partitioner run.
    
       Thus, existing MD devices will now be activated at the begining of
       the partionner.  (Closes: #391474)
    
       The same code snippet in mdcfg is now only called if /proc/mdstat did
       exist before.  The attempt to load the ancient "md" module has also
       been removed.
    
       init.d/md has been moved before init.d/lvm in order to correctly detect
       the presence of LVM Physical Volumes on RAID partitions.
    
     * Keep configurations of RAID partitions accross partman restarts
    
       MD devices were previously skipped in init.d/parted, resulting in the
       loss of the previous configuration.  We now only skip deactivated RAID
       devices, in a similar way than sataraid and multipath devices are
       skipped.
    
       Most of the job of init.d/md and init.d/md-devices have been cleaned up
       and merged into init.d/md to cope with the previous change. The
       initialization scheme is now closer to what is done for LVM.
    
       (Closes: #391479, #391483, #393728, #398668, #475479)
    
     * Stop loading raid* kernel modules manually
    
       Manually loading raid* kernel modules is not needed with the current
       Linux kernels.  They will be automatically loaded when detecting or
       creating a new MD device.

diff --git a/packages/mdcfg/debian/changelog b/packages/mdcfg/debian/changelog
index 2543ba2..42e479a 100644
--- a/packages/mdcfg/debian/changelog
+++ b/packages/mdcfg/debian/changelog
@@ -1,3 +1,12 @@
+mdcfg (1.27) UNRELEASED; urgency=low
+
+  [ Jérémy Bobbio ]
+  * mdcfg now load kernel modules and scan MD devices only if /proc/mdstat did
+    not exist before.
+  * Remove the attempt to load the anciant module "md".
+
+ -- Jérémy Bobbio <lunar@debian.org>  Thu, 29 May 2008 17:46:31 +0000
+
 mdcfg (1.26) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/packages/mdcfg/mdcfg.sh b/packages/mdcfg/mdcfg.sh
index 37a1f09..869d625 100755
--- a/packages/mdcfg/mdcfg.sh
+++ b/packages/mdcfg/mdcfg.sh
@@ -502,31 +502,31 @@ md_mainmenu() {
 
 ### Main of script ###
 
-# Try to load the necesarry modules.
-# Supported schemes: RAID 0, RAID 1, RAID 5
-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
-# kernels >=2.6.18 have raid456
-modprobe raid456 >/dev/null 2>&1 || modprobe raid5 >/dev/null 2>&1
-
-# Try to detect MD devices, and start them
-# mdadm will fail if /dev/md does not already exist
-mkdir -p /dev/md
-
-log-output -t mdcfg --pass-stdout \
-	mdadm --examine --scan --config=partitions >/tmp/mdadm.conf
-
-log-output -t mdcfg \
-	mdadm --assemble --scan --run --config=/tmp/mdadm.conf --auto=yes
-
-# Make sure that we have md-support
-if [ ! -e /proc/mdstat ]; then
-	db_set mdcfg/nomd false
-	db_input high mdcfg/nomd
-	db_go
-	exit 0
+# Load the modules and scan for MD devices if needed
+if ! [ -e /proc/mdstat ]; then
+	# Try to load the necesarry modules.
+	# Supported schemes: RAID 0, RAID 1, RAID 5
+	depmod -a >/dev/null 2>&1
+	modprobe md-mod >/dev/null 2>&1
+
+	# Make sure that we have md-support
+	if [ ! -e /proc/mdstat ]; then
+		db_set mdcfg/nomd false
+		db_input high mdcfg/nomd
+		db_go
+		exit 0
+	fi
+
+	# Try to detect MD devices, and start them
+	# mdadm will fail if /dev/md does not already exist
+	mkdir -p /dev/md
+
+	log-output -t mdcfg --pass-stdout \
+		mdadm --examine --scan --config=partitions >/tmp/mdadm.conf
+
+	log-output -t mdcfg \
+		mdadm --assemble --scan --run \
+		--config=/tmp/mdadm.conf --auto=yes
 fi
 
 # Force mdadm to be installed on the target system
diff --git a/packages/partman/partman-base/debian/changelog b/packages/partman/partman-base/debian/changelog
index e81d2bf..bd3c85a 100644
--- a/packages/partman/partman-base/debian/changelog
+++ b/packages/partman/partman-base/debian/changelog
@@ -1,10 +1,15 @@
 partman-base (121) UNRELEASED; urgency=low
 
+  [ Frans Pop ]
   * Add divider below "Use as" in ithe partition options dialog. If the
     partition is used for encryption, "Encryption method" will also be
     above the divider. As changing these option changes defaults and what
     other options are available, this provides a useful visual separation.
 
+  [ Jérémy Bobbio ]
+  * Instead of skipping every MD devices during partman initialization, we
+    now only skip the ones that are deactivated.  (Closes: #475479)
+
  -- Frans Pop <fjp@debian.org>  Fri, 30 May 2008 17:56:28 +0200
 
 partman-base (120) unstable; urgency=high
diff --git a/packages/partman/partman-base/init.d/parted b/packages/partman/partman-base/init.d/parted
index 346170a..7c070fe 100755
--- a/packages/partman/partman-base/init.d/parted
+++ b/packages/partman/partman-base/init.d/parted
@@ -6,6 +6,15 @@ set -e
 
 ORIG_IFS="$IFS"
 
+is_unactive_md() {
+	local number
+	number=$(echo "$1" | sed -n -e 's,/dev/md/\?,,p')
+	if [ "$number" ] && ! grep -q "^md$number :" /proc/mdstat; then
+		return 0
+	fi
+	return 1
+}
+
 part_of_sataraid () {
 	local raiddev
 	for raiddev in $(dmraid -r -c); do
@@ -52,8 +61,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 
 	IFS="$NL"
 	for partdev in $(parted_devices |
-		grep -v '^/dev/md' |
-		sed 's,^/dev/\(ide\|scsi\|[hs]d\),!/dev/\1,' |
+		sed 's,^/dev/\(ide\|scsi\|[hs]d\|md/\?[0-9]\+\),!/dev/\1,' |
 		sort |
 		sed 's,^!,,' ); do
 
@@ -65,6 +73,13 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		size=$2
 		model=$3
 
+		# Skip MD devices which are not active
+		if [ -e /proc/mdstat ]; then
+			if is_unactive_md $device; then
+				continue
+			fi
+		fi
+
 		# Skip devices that are part of a dmraid device
 		if type dmraid >/dev/null 2>&1; then
 			if part_of_sataraid $device; then
diff --git a/packages/partman/partman-md/debian/changelog b/packages/partman/partman-md/debian/changelog
index e93fc37..3dfc95c 100644
--- a/packages/partman/partman-md/debian/changelog
+++ b/packages/partman/partman-md/debian/changelog
@@ -1,3 +1,15 @@
+partman-md (42) UNRELEASED; urgency=low
+
+  [ Jérémy Bobbio ]
+  * Clean up the initialization of MD devices.  Together with the changes
+    introduced in partman-base (>= 121), setup of RAID devices won't be lost
+    across partman restarts anymore.
+    (Closes: #391479, #391483, #393728, #398668)
+  * Load the necessary modules and scan RAID arrays during partman
+    initialization.  (Closes: #391474)
+
+ -- Jérémy Bobbio <lunar@debian.org>  Thu, 29 May 2008 16:02:39 +0000
+
 partman-md (41) unstable; urgency=low
 
   [ Frans Pop ]
diff --git a/packages/partman/partman-md/debian/control b/packages/partman/partman-md/debian/control
index 08c74b5..f4f96d9 100644
--- a/packages/partman/partman-md/debian/control
+++ b/packages/partman/partman-md/debian/control
@@ -9,5 +9,5 @@ Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/partman/partman-md
 Package: partman-md
 XC-Package-Type: udeb
 Architecture: all
-Depends: ${misc:Depends}, mdadm-udeb, mdcfg-utils, partman-base (>= 114)
+Depends: ${misc:Depends}, mdadm-udeb, mdcfg-utils, partman-base (>= 121)
 Description: Add to partman support for MD
diff --git a/packages/partman/partman-md/init.d/_numbers b/packages/partman/partman-md/init.d/_numbers
index 75ae141..139cb78 100644
--- a/packages/partman/partman-md/init.d/_numbers
+++ b/packages/partman/partman-md/init.d/_numbers
@@ -1,2 +1,2 @@
-31 md-devices
-51 md
+25 md-devices
+49 md
diff --git a/packages/partman/partman-md/init.d/md b/packages/partman/partman-md/init.d/md
index e5024f2..fb8ddac 100755
--- a/packages/partman/partman-md/init.d/md
+++ b/packages/partman/partman-md/init.d/md
@@ -2,16 +2,25 @@
 
 . /lib/partman/lib/base.sh
 
-# Load modules
-#depmod -a 1>/dev/null 2>&1
-#modprobe md 1>/dev/null 2>&1 || modprobe md-mod 1>/dev/null 2>&1
-#
-## Load supported personalities
-#modprobe raid1 1>/dev/null 2>&1
-#
-## Detect and start MD devices
-#/sbin/mdadm --examine --scan --config=partitions >/tmp/mdadm.conf
-#/sbin/mdadm --assemble --scan --run --config=/tmp/mdadm.conf --auto=yes
+# Check if we have RAID
+if [ ! -f /proc/mdstat ]; then
+	exit 0
+fi
+
+# Obtain the size of an MD device
+get_size () {
+	while [ -z "$(echo "$line" | grep "^md$NUMBER :")" ]; do
+		read line
+		[ $? -eq 1 ] && break  # EOF
+	done
+	read line
+	size=$(echo "$line" | sed -e 's/ blocks.*//')
+	# If the sed failed, the line didn't contain the size; just
+	# return 0 in that case.
+	if [ "$size" = "$line" ]; then
+		size=0
+	fi
+}
 
 # Mark all RAID partitions as being MD
 for dev in $DEVICES/*; do
@@ -28,6 +37,7 @@ for dev in $DEVICES/*; do
 	done
 	close_dialog
 
+	# Check if device/partitions are used for software RAID
 	for id in $partitions; do
 		md=no
 		open_dialog GET_FLAGS $id
@@ -43,38 +53,57 @@ for dev in $DEVICES/*; do
 		fi
 	done
 
-	# Next, check if the device is a part of an MD setup
-#	if [ -f device ]; then
-#		DEVICE=`sed -e "s/\/dev\///" device`
-#		grep -q "${DEVICE}" /proc/mdstat
-#		if [ $? -eq 0 ]; then
-#			open_dialog NEW_LABEL loop
-#			close_dialog
-#		fi
-#	fi
-done
+	# Check if the device is a software RAID device
+	if [ -f device ]; then
+		NUMBER=$(sed -e 's,/dev/md/\?,,' device)
+		if ! grep -q "^md$NUMBER :" /proc/mdstat; then
+			continue
+		fi
 
-# Create the raid devices
-# NOTE: /dev/md/X does not necessarily exist; /dev/mdX can exist alone
-#       (see #470374 for reference)
-#for i in $(grep md /proc/mdstat | \
-#	    sed -e 's/^\(md.*\) : active \([[:alnum:]]*\).*/\1/'); do
-#	NUMBER=$(echo $i | sed -e "s/^md//")
-#	DEVICE="$DEVICES/=dev=md$NUMBER"
-#	mkdir -p $DEVICE
-#	cd $DEVICE
-#	echo "/dev/md$NUMBER" > $DEVICE/device
-#	echo Unknown > $DEVICE/model
-#	echo "0" > $DEVICE/size
-#	open_dialog OPEN "/dev/md$NUMBER"
-#	read_line response
-#	close_dialog
-#	if [ "$response" = failed ]; then
-#		rm -rf $DEVICE
-#	fi
-#
-#	open_dialog NEW_LABEL loop
-#	close_dialog
-#done
+		# Set an appropriate value for device model
+		db_metaget partman-md/text/device description
+		echo "${RET}" > model
+
+		# fix size
+		get_size < /proc/mdstat
+		sector_size=$(grep " sectors" /proc/mdstat | sed -e 's/[^0-9]\+//g')
+		if [ -z "$sector_size" ]; then
+			sector_size=1024
+		fi
+		size=$(($size * $sector_size))
+		echo "$size" > size
+
+		# create a label
+		open_dialog NEW_LABEL loop
+		close_dialog
+		# find the free space
+		open_dialog PARTITIONS
+		free_space=''
+		while { read_line num id size type fs path name; [ "$id" ]; }; do
+			if [ "$fs" = free ]; then
+				free_space=$id
+				free_size=$size
+			fi
+		done
+		close_dialog
+		# create partition in the free space
+		if [ "$free_space" ]; then
+			open_dialog NEW_PARTITION primary ext2 $free_space full $free_size
+			read_line num id size type fs path name
+			close_dialog
+			if [ "$id" ]; then
+				open_dialog GET_FILE_SYSTEM $id
+				read_line filesystem
+				close_dialog
+				if [ "$filesystem" != none ]; then
+					open_dialog CHANGE_FILE_SYSTEM $id $filesystem
+					close_dialog
+				fi
+			fi
+		fi
+		open_dialog DISK_UNCHANGED
+		close_dialog
+	fi
+done
 
 exit 0
diff --git a/packages/partman/partman-md/init.d/md-devices b/packages/partman/partman-md/init.d/md-devices
index df9c785..768bf0b 100755
--- a/packages/partman/partman-md/init.d/md-devices
+++ b/packages/partman/partman-md/init.d/md-devices
@@ -2,94 +2,24 @@
 
 . /lib/partman/lib/base.sh
 
-# Check if we have RAID
-if [ ! -f /proc/mdstat ]; then
+# Load modules and scan arrays if it was not done before
+if [ -e /proc/mdstat ]; then
 	exit 0
 fi
 
-# Obtain the size of an MD device
-get_size () {
-	while [ -z "$(echo "$line" | grep "^md$NUMBER :")" ]; do
-		read line
-		[ $? -eq 1 ] && break  # EOF
-	done
-	read line
-	size=$(echo "$line" | sed -e 's/ blocks.*//')
-	# If the sed failed, the line didn't contain the size; just
-	# return 0 in that case.
-	if [ "$size" = "$line" ]; then
-		size=0
-	fi
-}
+# Try to load the necessary modules.
+# Supported schemes: RAID 0, RAID 1, RAID 5
+depmod -a >/dev/null 2>&1
+modprobe md-mod >/dev/null 2>&1
 
-# Create the raid devices
-for i in $(grep ^md /proc/mdstat | grep -v inactive | \
-	   sed -e 's/^\(md.*\) : active \([[:alnum:]]*\).*/\1/'); do
-	NUMBER="${i#md}"
-	if [ -e "/dev/md/${NUMBER}" ]; then
-		DEVICE="$DEVICES/=dev=md=${NUMBER}"
-		DEVNODE="/dev/md/${NUMBER}"
-	else
-		DEVICE="$DEVICES/=dev=md${NUMBER}"
-		DEVNODE="/dev/md${NUMBER}"
-	fi
-	mkdir -p ${DEVICE}
-	cd ${DEVICE}
-	echo "$DEVNODE" > ${DEVICE}/device
+# Try to detect MD devices, and start them
+# mdadm will fail if /dev/md does not already exist
+mkdir -p /dev/md
 
-	db_metaget partman-md/text/device description
-	echo "${RET}" > ${DEVICE}/model
+log-output -t md-devices --pass-stdout \
+	mdadm --examine --scan --config=partitions >/tmp/mdadm.conf
 
-	get_size < /proc/mdstat
-	sector_size=$(grep " sectors" /proc/mdstat | sed -e 's/[^0-9]\+//g')
-	if [ -z "$sector_size" ]; then
-		sector_size=1024
-	fi
-	size=$(($size * $sector_size))
-	echo "$size" > ${DEVICE}/size
-
-	open_dialog OPENED "$DEVNODE"
-	read_line response
-	close_dialog
-	if [ "$response" = no ]; then
-		open_dialog OPEN "$DEVNODE"
-		read_line response
-		close_dialog
-		if [ "$response" = failed ]; then
-			rm -rf ${DEVICE}
-		fi
-	fi
-
-	open_dialog NEW_LABEL loop
-	close_dialog
-
-	open_dialog PARTITIONS
-	free_space=''
-	while { read_line num id size type fs path name; [ "$id" ]; }; do
-		if [ "$fs" = free ]; then
-			free_space=$id
-			free_size=$size
-		fi
-	done
-	close_dialog
-
-	if [ "$free_space" ]; then
-		open_dialog NEW_PARTITION primary ext2 $free_space full $free_size
-		read_line num id size type fs path name
-		close_dialog
-		if [ "$id" ]; then
-			open_dialog GET_FILE_SYSTEM $id
-			read_line filesystem
-			close_dialog
-			if [ "$filesystem" != none ]; then
-				open_dialog CHANGE_FILE_SYSTEM $id $filesystem
-				close_dialog
-			fi
-		fi
-	fi
-
-	open_dialog DISK_UNCHANGED
-	close_dialog
-done
+log-output -t md-devices \
+	mdadm --assemble --scan --run --config=/tmp/mdadm.conf --auto=yes
 
 exit 0

commit 508059b3f545f46342b4e13025de403453c6b41d
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Tue Jun 3 15:51:06 2008 +0000

    Remove MD devices when creating a new disk label
    
    In create_new_label(), we now remove MD devices like it was already done
    for LVM.  As partman-md now scans for existing MD devices during
    partman initialization, it is required in order to make automatic
    partitioning working on disks which was previously used for an MD device.
    
    A small library, lib/md-remove.sh has been added to partman-md in order to
    do so.

diff --git a/packages/partman/partman-md/debian/changelog b/packages/partman/partman-md/debian/changelog
index 3dfc95c..da5a90f 100644
--- a/packages/partman/partman-md/debian/changelog
+++ b/packages/partman/partman-md/debian/changelog
@@ -7,6 +7,9 @@ partman-md (42) UNRELEASED; urgency=low
     (Closes: #391479, #391483, #393728, #398668)
   * Load the necessary modules and scan RAID arrays during partman
     initialization.  (Closes: #391474)
+  * Add device_remove_md() in lib/md-remove.sh: it is necessary to allow
+    proper removal of MD devices when we create a new label on a disk
+    (for example, by automatic partitioning).
 
  -- Jérémy Bobbio <lunar@debian.org>  Thu, 29 May 2008 16:02:39 +0000
 
diff --git a/packages/partman/partman-md/debian/rules b/packages/partman/partman-md/debian/rules
index 60ead47..7f682c4 100755
--- a/packages/partman/partman-md/debian/rules
+++ b/packages/partman/partman-md/debian/rules
@@ -24,7 +24,7 @@ install: build
 	debian/install-rc choose_partition
 	debian/install-rc init.d
 	debian/install-rc update.d
-	#dh_install parted_names lib/partman
+	dh_install lib lib/partman
 
 binary-indep: build install
 	dh_testdir
diff --git a/packages/partman/partman-md/lib/md-remove.sh b/packages/partman/partman-md/lib/md-remove.sh
new file mode 100644
index 0000000..9b07fe3
--- /dev/null
+++ b/packages/partman/partman-md/lib/md-remove.sh
@@ -0,0 +1,60 @@
+# Wipes any traces of an active MD on the given device
+device_remove_md() {
+	local dev md_dev md_devs used_parts type device_dir
+	dev="$1"
+	cd $dev
+
+	realdev=$(mapdevfs "$(cat $dev/device)")
+	md_devs=$(sed -n -e \
+		"s,^\(md[0-9]*\) : active raid[0-9]* .*${realdev#/dev/}[^[]*\[[0-9]\].*,/dev/\1,p" \
+		/proc/mdstat)
+	for md_dev in $md_devs; do
+		if [ -e /lib/partman/lib/lvm-remove.sh ]; then
+			. /lib/partman/lib/lvm-remove.sh
+			device_remove_lvm "$md_dev" || return 1
+		fi
+
+		used_parts=$(mdadm -Q --detail $md_dev |
+			grep -E "^[[:space:]]*[0-9].*(active|spare)" |
+			sed -e 's/.* //')
+		type="$(mdadm -Q --detail $md_dev |
+			sed -n -e 's/^.*Raid Level : \(.*\)/\1/p')"
+
+		db_subst mdcfg/deleteverify DEVICE $md_dev
+		db_subst mdcfg/deleteverify TYPE $type
+		db_subst mdcfg/deleteverify DEVICES "$used_parts"
+		db_input critical mdcfg/deleteverify
+		db_go || return 1
+		db_get mdcfg/deleteverify
+		if [ "$RET" = true ]; then
+			db_reset mdcfg/deleteverify
+			logger -t md-remove "Removing $md_dev ($used_parts)"
+			log-output -t md-remove mdadm --stop $md_dev || return 1
+			for part in $used_parts; do
+				log-output -t md-remove mdadm \
+					--zero-superblock --force $part || return 1
+			done
+		else
+			db_reset mdcfg/deleteverify
+			return 1
+		fi
+	done
+
+	# Make sure that parted has no stale info on the MD
+	restart=""
+	for md_dev in $md_devs; do
+		device_dir="$DEVICES/$(echo $md_dev | sed -e 's,/,=,g')"
+		if ! [ -d "$device_dir" ]; then
+			continue
+		fi
+		rm -rf $device_dir
+		restart=1
+	done
+
+	if [ "$restart" ]; then
+		stop_parted_server
+		restart_partman || return 1
+	fi
+
+	return 0
+}
diff --git a/packages/partman/partman-partitioning/debian/changelog b/packages/partman/partman-partitioning/debian/changelog
index 7da50d7..5051aab 100644
--- a/packages/partman/partman-partitioning/debian/changelog
+++ b/packages/partman/partman-partitioning/debian/changelog
@@ -14,6 +14,11 @@ partman-partitioning (60) UNRELEASED; urgency=low
   * Disable "resize" and "delete" for partitions on "loop" partition tables.
     This will prevent unusable behaviour on RAID, crypto and LVM partitions.
     (Closes: #318228, #417973)
+  * In create_new_label(), we now remove MD devices like it was already done
+    for LVM.  As partman-md now scans for existing MD devices during partman
+    initialization, it is required in order to make automatic partitioning
+    working on disks which was previously used for an MD device.
+    Requires partman-md (>= 42).
 
  -- Colin Watson <cjwatson@debian.org>  Tue, 27 May 2008 10:17:15 +0100
 
diff --git a/packages/partman/partman-partitioning/lib/disk-label.sh b/packages/partman/partman-partitioning/lib/disk-label.sh
index d2696be..e9b3a94 100644
--- a/packages/partman/partman-partitioning/lib/disk-label.sh
+++ b/packages/partman/partman-partitioning/lib/disk-label.sh
@@ -170,6 +170,10 @@ create_new_label() {
 		. /lib/partman/lib/lvm-remove.sh
 		device_remove_lvm "$dev" || return 1
 	fi
+	if [ -e /lib/partman/lib/md-remove.sh ]; then
+		. /lib/partman/lib/md-remove.sh
+		device_remove_md "$dev" || return 1
+	fi
 
 	cd $dev
 

Attachment: signature.asc
Description: Digital signature


Reply to: