[Top][All Lists]

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

Re: problems detecting partition map on software RAID

From: Sam Morris
Subject: Re: problems detecting partition map on software RAID
Date: Sun, 20 May 2007 14:53:47 +0100

reopen 423022

Hm, this isn't quite fixed yet... users of software RAID still won't be
able to boot up, as the generated core.img will not contain the 'raid'

In fact, I get the error message 'you need to load the kernel first'
which doesn't make much sense... I would have expected something more
along the lines of 'No such device: (md0)'.

Anyway, here's what I came up with for grub-install. It's ugly, but
that's shell scripting for you. ;)

        # Then the partition map module.
        partmap_module=`$grub_probe --target=partmap --device-map=${device_map} 
        if test "x$partmap_module" = x -a "x$modules" = x; then
            grub_device="$($grub_probe --target=device 
--device-map=${device_map} ${grubdir})"
            dev="$(stat -c %t:%T "$grub_device")"
            # Ugh, shell scripting is crap! Can't use a subshell because it 
            # update the value of partmap_module. Better hope there are never 
            # kobjects that contain whitespace in their name...
            for ko in $(find /sys/block -name dev -exec dirname {} \;); do
                if test "$(cat "$ko/dev")" = "$dev"; then
                    partmap_module='pc gpt'
                    case "$ko" in
                        partmap_module="$partmap_module raid"
                    # Partitionable arrays are apparantly detected by 
grub-probe, so
                    # no need to check for them here.
                    #   ;;
                        # We should really look through the output of 
'lvdisplay -c'
                        # at this point, searching for a LVM logical volume 
                        # matches the detected device's major/minor numbers.
                        # If that fails then we know it's not LVM; if GRUB later
                        # grows support for other device-mapper mappings then
                        # the output of 'dmsetup status' could be used here.
                        echo "Assuming that the device-mapper device '$ko' is 
part" 1>&2
                        echo "of an LVM logical volume. If this is not the 
case," 1>&2
                        echo "specify the correct modules with the option 
\`--modules'." 1>&2
                        partmap_module="$partmap_module lvm"
                        echo "I don't know which modules GRUB needs to use to 
access a" 1>&2
                        echo "device of type '$ko'." 1>&2
                        unset partmap_module
        if test "x$partmap_module" = x -a "x$modules" = x; then
            echo "Auto-detection of a partition map module failed." 1>&2
            echo "Please specify the module with the option \`--modules' 
explicitly." 1>&2
            exit 1
Maybe it would be easier to simply include 'raid' and 'lvm' in the
fallback list...

Sam Morris

PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]