Hi All,

The 10-setup in GRUB_PC as provided with 4.0~beta2+experimental41 does not seem 
to work for software raid. I managed to make it work after a fashion, but not 
elegantly so, as you'll see.

Hope I'm not going overboard with providing information, but more is better 
than less, I'd imagine.

My fai server is Debian GNU/Linux 5.0 \n \l  and I am installing the same.

dpkg --list | grep fai
ii  fai-client                        4.0~beta2+experimental41   Fully 
Automatic Installation client package
ii  fai-doc                           4.0~beta2+experimental41   Documentation 
for FAI
ii  fai-server                        4.0~beta2+experimental41   Fully 
Automatic Installation server package
ii  fai-setup-storage                 4.0~beta2+experimental41   automatically 
prepare storage devices

/usr/share/doc/fai-doc/examples/simple/scripts/GRUB_PC/10-setup/config/scripts/GRUB_PC/10-setup

#! /bin/bash

error=0 ; trap "error=$((error|1))" ERR

set -a

# during softupdate use this file
[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh

[ -z "$BOOT_DEVICE" ]    && exit 701

$ROOTCMD grub-mkdevicemap --no-floppy

for device in $BOOT_DEVICE; do
  $ROOTCMD /usr/sbin/grub-install --no-floppy --modules="lvm raid" "$device"
done

$ROOTCMD update-grub

exit $error

The scenario:

We have a number of servers, of which we have two classes: multidisk hardware 
raid, and 2 disk software raid (raid1). On all servers we have /boot as the 
first partition, then swap, then /. The provided sample 10-setup did work 
successfully with the hardware raid servers, however on the software raid 
servers it did not.

What do I mean didn't work?

The script actually ran with no error, nothing in fai.log or the error log to 
indicate a problem. No issues in shell.log. But, the servers would reboot, go 
to grub, then error 15, which is file not found. Pretty vexing.

What finally did work?

I came out with a pretty crude hack, as you see below. It is a combination of 
parts that I've found posted here. The reason I call it crude is obvious, I'm 
sure. I'm hardcoding  the SW_RAID part of the script to match my needs, boot 
being (md0) not (hd0), but a more elegant solution would be to programmatically 
determine the correct place for it. I am setting TYPE=HW_RAID or TYPE=SW_RAID 
in my vars file for the case switch, and while seems to make it work OK it 
would be far nicer if the script could figure this out by itself. In any event, 
I've just got to think I'm not the only guy trying to get software raid going 
and the supplied 10-setup doesn't seem to work for it at all. At least this 
should help.

$FAI/config/scripts/GRUB_PC/10-setup

#! /bin/bash

# copyright Thomas Lange 2001-2007, [email protected]

error=0 ; trap "error=$((error|1))" ERR

# during softupdate use this file
[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh

[ -z "$BOOT_DEVICE" ]    && exit 701

# FIXME terrible hack below here. I'm assuming that SW_RAID is always using 
/dev/md0 as the BOOT_DEVICE
# This may not necessarily be true and needs to be fixed programatically.

case $TYPE in

   HW_RAID)

        $ROOTCMD /usr/bin/grub-mkimage --output=/boot/grub/core.img ext2 pc 
biosdisk raid
        $ROOTCMD /usr/sbin/grub-install $BOOT_DEVICE
        $ROOTCMD /usr/sbin/grub-setup $BOOT_DEVICE
        $ROOTCMD /usr/sbin/update-grub
        $ROOTCMD update-initramfs -k all -u
        ;;

   SW_RAID)

        $ROOTCMD /usr/bin/grub-mkimage --output=/boot/grub/core.img ext2 pc 
biosdisk raid
        $ROOTCMD /usr/sbin/grub-install '(md0)'
        $ROOTCMD /usr/sbin/grub-setup '(md0)'
        $ROOTCMD /usr/sbin/update-grub
        $ROOTCMD update-initramfs -k all -u
        ;;

esac

exit $error



David Dreezer
Social Strata, Inc.



Antwort per Email an