Bug#478547: Different patch

Goswin Brederlow goswin-v-b at web.de
Wed Apr 30 18:41:37 UTC 2008


Package: grub
Version: 0.97-37
Followup-For: Bug #478547

Hi,

grub-install already contains a function getraid_mdadm() to resolve
raid devices but it is never called. The attached patch makes use of
that function instead of introducing its own.

One difference between the two versions I did spot is the behaviour
when mdadm is not installed:

---------------------------[ original patch] -------------------------
root at frosties:/tmp# ./grub-install '(hd0)' 
Searching for GRUB installation directory ... found: /boot/grub
The file /boot/grub/stage1 not read correctly.
----------------------------------------------------------------------

-----------------------------[ this patch] ---------------------------
root at frosties:/tmp# ./grub-install '(hd0)' 
./grub-install: line 91: mdadm: command not found
: mdadm -D /dev/md0 failed
----------------------------------------------------------------------

I also added a message "Using /dev/sdb1 from raid device /dev/md0" to
show what is going on. sdb1 is the lowest numbered component in my
raid 1 (see /proc/mdstat below).

MfG
	Goswin

-- Package-specific info:

*********************** BEGIN /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md0 : active raid1 sdc1[1] sdb1[0]
      1003904 blocks [2/2] [UU]
      
unused devices: <none>
*********************** END /proc/mdstat

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/sda
(hd1)	/dev/sdb
(hd2)	/dev/sde
(hd3)	/dev/sdf
*********************** END /boot/grub/device.map

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22.2-mrvn
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages grub depends on:
ii  grub-common              1.96+20080426-1 GRand Unified Bootloader, version 

grub recommends no packages.

-- no debconf information
-------------- next part --------------
--- /usr/sbin/grub-install	2008-04-26 19:47:18.000000000 +0200
+++ /tmp/grub-install	2008-04-30 20:35:54.007598750 +0200
@@ -129,7 +129,12 @@
 # Convert an OS device to the corresponding GRUB drive.
 # This part is OS-specific.
 convert () {
-	GRUB_LEGACY_0_BASED_PARTITIONS=1 grub-probe --device-map=${device_map} -t drive -d "$1"
+	case "$1" in
+	    (/dev/md*) dev=`getraid_mdadm "$1"` || exit 1
+	               echo >&2 "Using $dev from raid device $1";;
+	    (*) dev="$1";;
+	esac
+	GRUB_LEGACY_0_BASED_PARTITIONS=1 grub-probe --device-map=${device_map} -t drive -d "$dev"
 }
 
 # Usage: resolve_symlink file


More information about the Pkg-grub-devel mailing list