mdadm raid1 booting

ANDERSON RUSSELL D (ANDY) RXANDERS at srpnet.com
Mon Dec 13 20:15:32 CET 2004


Could someone maybe help me out getting this mdadm raid 1 boot working?

Thanks, Andy

I can not get lilo or grub to boot work after a mdadm raid install (also with/out raidtools2).
I included the partition.ATA_RAID hook script that appears to run with no problems.
I always get a zero byte initrd.img-2.6.8-1-686-smp.new file and no boot directory with these errors:

shell.log:Failed to create initrd image.
shell.log:dpkg: error processing kernel-image-2.6.8-1-686-smp (--configure):
shell.log: subprocess post-installation script returned error exit status 9
shell.log:Errors were encountered while processing:
shell.log:E: Sub-process /usr/bin/dpkg returned an error code (1)
shell.log:DEFAULT/S01          FAILED with exit code 1.
shell.log:Syntax error at or above line 2 in file '/etc/lilo.conf'
shell.log:DEFAULT/S10          FAILED with exit code 1.
shell.log:rm: cannot remove directory `/tmp/target/tmp': Device or resource busy
shell.log:Failed to create initrd image.
shell.log:dpkg: error processing kernel-image-2.6.8-1-686-smp (--configure):
shell.log: subprocess post-installation script returned error exit status 9
shell.log:Errors were encountered while processing:
shell.log:E: Sub-process /usr/bin/dpkg returned an error code (1)

Setting up kernel-image-2.6.8-1-686-smp (2.6.8-5) ...
/usr/sbin/mkinitrd: RAID support requires raidtools2
Failed to create initrd image.
dpkg: error processing kernel-image-2.6.8-1-686-smp (--configure):
 subprocess post-installation script returned error exit status 9
Errors were encountered while processing:
 kernel-image-2.6.8-1-686-smp
E: Sub-process /usr/bin/dpkg returned an error code (1)
fcopy: /fai/files/etc/hostname is not a directory. Not copied.
fcopy: /fai/files/etc/hosts is not a directory. Not copied.
fcopy: /fai/files/etc/motd is not a directory. Not copied.
fcopy: /fai/files/etc/X11/XF86Config is not a directory. Not copied.
fcopy: copied /fai/files/etc/X11/XF86Config-4/DEFAULT to /tmp/target/etc/X11/XF8
6Config-4
DEFAULT/S01          FAILED with exit code 1.

partition.ATA_RAID file:

#!/bin/bash -x

#****************************************************
# build a raid array for filesystems
#****************************************************

# let FAI partition disks and then we'll modify
task_partition

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

# 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

# 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




More information about the linux-fai mailing list