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

Bug#273960: Unconfusing os-prober with SW-RAID...



tags 273960 + patch
thanks

> If I install with root on software raid1, os-prober sees the component
> drives as separate linux installs. If one is a spare, linux-os-prober
> probably cannot mount it to work out how to boot it. Otherwise, it
> thinks it figures this out. Amusing results in grub-installer either
> way.

Hi Joey, 

Here's a possible patch for this issue.
I've not yet committed it because I wanted to see if you like the idea 
first. Please let me know and I'll commit.

What I do is skip any partitions that are part of a software raid array.
Tested.

Cheers,
Frans

Index: os-prober
===================================================================
--- os-prober	(revision 25185)
+++ os-prober	(working copy)
@@ -7,6 +7,24 @@
 	find /dev/discs/ -follow -type b | grep /part
 }
 
+test_raid () {
+	[ -f /proc/mdstat ] || return 1
+
+	disk=$(echo $1 | cut -d"/" -f1-4)
+	[ -z "$disk" ] && return 1
+	part=$(echo $1 | sed "s:$disk::")
+
+	realdev=$(readlink $disk | sed "s:^\.\./::")
+	[ -z "$realdev" ] && return 1
+
+	if grep -q "^md.*$realdev$part" /proc/mdstat ; then
+		debug "$1: part of software raid array"
+		return 0
+	else
+		return 1
+	fi
+}
+
 for prog in /usr/lib/os-probes/init/*; do
 	if [ -x $prog ] && [ -f $prog ]; then
 		debug "running init $prog"
@@ -15,6 +33,9 @@
 done
 
 for partition in $(partitions); do
+	# Skip partitions used in software RAID arrays
+	test_raid $partition && continue
+
 	if ! grep -q "^$partition " /proc/mounts; then
 		for test in /usr/lib/os-probes/*; do
 			if [ -x $test ] && [ -f $test ]; then

Reply to: