mdadm raid1 booting

malk at sidehack.sat.gweep.net malk at sidehack.sat.gweep.net
Thu Dec 16 04:50:01 CET 2004


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

If you add a hook called configure.SOME_CLASS that
does fcopy /etc/raidtab to get a raidtab in place before
mkinitrd above runs, the error goes away.  mkinitrd simply
checks for the existence of /etc/raidtab in your target install
and if it doesn't find it, it spits out "RAID support requires
raidtools2".  I think it does the test for /etc/raidtab when
it detects a root raid situation (it's told root is on an
md device).

I've got an example RAID-1 setup of config files that go on top
of the FAI simple example posted here if you want to get something
working quickly:

http://www.linuxma.com/fai_raid

-Eric Malkowski

> 
> 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