mdadm raid1 booting

Markus Törnqvist mjt at nysv.org
Wed Dec 15 14:42:59 CET 2004


On Mon, Dec 13, 2004 at 12:15:32PM -0700, ANDERSON RUSSELL D (ANDY) wrote:
>Could someone maybe help me out getting this mdadm raid 1 boot working?
                                              ^^^^^
You misspelled "damn" ;) -----------------------/

>I can not get lilo or grub to boot work after a mdadm raid install (also
>with/out raidtools2).  

I'm having similar problems, maybe this can be of benefit to both of us.
I haven't followed the list as much as I should have and now face the
task of trawling it through..

>I included the partition.ATA_RAID hook script that
>appears to run with no problems.

I tried to write a similar hook, but it never seemed to get executed(!)

Are these hooks pre-install ones? What special magick should I chant
to get them running? :)

I have Mr. Vilain's script from:
http://web.archive.org/web/20040102221743/http://vilain.net/linux/fai/

With IDE_RAID1 modified to suit my needs.
I also had the change the drive detection code in setup_harddisks.

One problem is that although I boot with LILO lilo doesn't even get
installed. Any ideas why?

The other is, why isn't that setup_harddisks merged into mainline FAI?
Or is it but not documented? Seems to me like this all-raid1 setup
would be the most used application of FAI, since it's such a task
to install manually...

>shell.log:Syntax error at or above line 2 in file '/etc/lilo.conf'
>shell.log:DEFAULT/S10          FAILED with exit code 1.

What does it look like there?
I have added raid-extra-boot="/dev/hda,/dev/hdc" in my S10 
if ifclass SOFTRAID1 but still no lilo is installed.

>Setting up kernel-image-2.6.8-1-686-smp (2.6.8-5) ...
>/usr/sbin/mkinitrd: RAID support requires raidtools2

Bizarro, iirc my setup installs raidtools2 just by itself. In DEFAULT
or somesuch.

I have to say here that this is something of the lowest priority, so
I get to advance my FAI toy maybe a few hours per week, which makes
this all the more interesting ;)

>partition.ATA_RAID file:

I added my questions in form of comments ;)

>#!/bin/bash -x
>
>#****************************************************
># build a raid array for filesystems
>#****************************************************
>
># let FAI partition disks and then we'll modify
>task_partition

# Is this supposed to be one line?

># get list of partitions

>disks="/dev/sda /dev/sdc"
>partitions=$(sfdisk -l $disks|grep "^/dev/sd[a-z][0-9]"|cut -d" " -f1)

# The line I edited in Mr. Vilain's script looked like this, but I
# had /dev/hda /dev/hdc as disks in a similar sfdisk magic.

># change partition type to raid

>for partition in ${partitions[@]}; do
>        dev=$(echo $partition | tr -d '[:digit:]')
>        part=$(echo $partition | tr -cd '[:digit:]')
>        id=$(sfdisk --print-id $dev $part)
>        case ${id} in
>                82) sfdisk --change-id $dev $part fd ;;
>                83) sfdisk --change-id $dev $part fd ;;
>        esac
>done
>
># partition mirror disks

>sfdisk -d /dev/sda | sfdisk /dev/sdb
>sfdisk -d /dev/sdc | sfdisk /dev/sdd

# Took me a second reading to see that you use the partitions
# that you have already, right?

># create raid array for each partition

>mdadm -C /dev/md1 -v -R -f -l1 -c128 -n2 /dev/sd[ab]1   # /
>mdadm -C /dev/md5 -v -R -f -l1 -c128 -n2 /dev/sd[ab]5   # swap
>mdadm -C /dev/md6 -v -R -f -l1 -c128 -n2 /dev/sd[ab]6   # /var
>mdadm -C /dev/md7 -v -R -f -l1 -c128 -n2 /dev/sd[ab]7   # /tmp
>mdadm -C /dev/md8 -v -R -f -l1 -c128 -n2 /dev/sd[ab]8   # /usr
>mdadm -C /dev/md9 -v -R -f -l1 -c128 -n2 /dev/sd[ab]9   # /opt
>mdadm -C /dev/md10 -v -R -f -l1 -c128 -n2 /dev/sd[ab]10 # /local

>mdadm -C /dev/md11 -v -R -f -l1 -c128 -n2 /dev/sd[cd]1  # /export
>
># create filesystems

>arrays=$(cat /proc/mdstat|grep "^md[0-9]"|cut -d" " -f1)
>for array in ${arrays[@]}; do
>        echo y | mkreiserfs -f -q /dev/${array}
>done
>
># create swap

>mkswap /dev/md5
>
># create /etc/fstab

>cat > ${LOGDIR}/fstab << EOF
># /etc/fstab: static file system information.

>#<file sys>  <mount point>    <type>    <options> <dump> <pass>
>/dev/md1     /                reiserfs  defaults  0      1
>/dev/md5     none             swap      rw        0      0
>none         /proc            proc      defaults  0      0
>/dev/md10    /local           reiserfs  defaults  0      2
>/dev/md9     /opt             reiserfs  defaults  0      2
>/dev/md7     /tmp             reiserfs  defaults  0      2
>/dev/md8     /usr             reiserfs  defaults  0      2
>/dev/md6     /var             reiserfs  defaults  0      2
>/dev/md11    /export          reiserfs  defaults  0      2
>EOF
>
># create new disk variables

>cat > $diskvar << EOF
>BOOT_DEVICE=/dev/sda
>ROOT_PARTITION=/dev/md1
>BOOT_PARTITION=/dev/md1
>SWAPLIST="/dev/md5"
>EOF
>
>. $diskvar
>
>skiptask partition

# Couldn't you do partition to automagically partition the sda and
# sdc for sdb and sdd?
# Place this hook after partition?

Otherwise this seems like my initial approach, but yeah, now I have
the bigger task of having an unbootable system.. I never got it to boot
even with a vanilla FAI example installation :P

I boot with (the relevant fai options):
FA I_ACTION=install FAI_FLAGS=verbose,sshd,createvt,syslogd,debug LILO SOFTRAID1 MBR

Is there something obviously wrong here?

I can't remember if package_config/DEFAULT had this by default but
this is a snippet from mine:
PACKAGES install GRUB
grub lilo-

PACKAGES install LILO
lilo grub-

Thanks a million for any comments/helps/anything you have! :)

-- 
mjt



More information about the linux-fai mailing list