X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=mod-md.sh;h=a3585170fb7bb56e1db25ed4f72f75ffe64d717a;hb=04b32086569a126d5d6f9bd0ad1b0db9f142f50e;hp=7d4d88404bac3dc3f63fc549edf77912b20f002f;hpb=5764872b6a447e5123b80def4c42720b7c47f68e;p=projects%2Fgeninitrd.git diff --git a/mod-md.sh b/mod-md.sh index 7d4d884..a358517 100644 --- a/mod-md.sh +++ b/mod-md.sh @@ -1,6 +1,4 @@ #!/bin/sh -MD_RCSID='$Revision$ $Date:: $' - # geninitrd mod: mdadm USE_MD=${USE_MD:-yes} @@ -10,10 +8,6 @@ have_md=no # setup geninitrd module # @access public setup_mod_md() { - mdassemble=$(find_tool $initrd_dir/mdassemble /sbin/initrd-mdassemble) - if [ ! -x "$mdassemble" ]; then - USE_MD=no - fi mdadm=$(find_tool /sbin/mdadm $initrd_dir/mdadm /sbin/initrd-mdadm) if [ ! -x "$mdadm" ]; then USE_MD=no @@ -46,7 +40,7 @@ find_modules_md() { local found raidlevel if [ -f /etc/mdadm.conf ]; then - debug "Finding RAID details using mdadm for rootdev=$1" + verbose "Finding RAID details using mdadm for rootdev=$1" eval `($mdadm -v --examine --scan --config=/etc/mdadm.conf 2> /dev/null;$mdadm -v --detail --scan --config=/etc/mdadm.conf 2> /dev/null) | awk -v rootdev="$1" ' BEGIN { found = "no"; @@ -119,7 +113,7 @@ find_modules_md() { die "RAID devices not found for \"$1\", check your configuration!" fi - debug "md: found rootdev=$1 on device $rootdev_new with devices list ${dev_list}" + verbose "md: found rootdev=$1 on device $rootdev_new with devices list ${dev_list}" rootdev_nr=$(( $rootdev_nr + 1 )) eval "rootdev${rootdev_nr}=\"$rootdev_new\"" @@ -137,17 +131,19 @@ initrd_gen_md() { if ! is_yes "$have_md"; then return fi - debug "Setting up mdadm..." + verbose "Setting up mdadm..." - inst_exec $mdassemble /bin/mdassemble + inst_exec $mdadm /sbin/mdadm + + echo "DEVICE partitions containers" >> "$DESTDIR/etc/mdadm.conf" # LVM on RAID case local dev_list_extra ex_dev dev_list_extra=$(awk '/^DEVICE / { for (i=2; i<=NF; i++) { printf "%s ", $i; }; } ' /etc/mdadm.conf | xargs) new_dev_list_extra="" for ex_dev in $dev_list_extra; do - if [ "$ex_dev" = "partitions" ]; then - echo "DEVICE partitions" >> "$DESTDIR/etc/mdadm.conf" + if [ "$ex_dev" = "partitions" -o "$ex_dev" = "containers" ]; then + echo "DEVICE $ex_dev" >> "$DESTDIR/etc/mdadm.conf" # FIXME: find and copy partition devices from /proc/partitions # - best if done at runtime, now initrd gen time continue @@ -161,7 +157,7 @@ initrd_gen_md() { for nr in `seq 1 $rootdev_nr`; do eval cr_rootdev="\$rootdev${nr}" eval cr_dev_list="\$dev_list${nr}" - debug echo "Setting up array ($cr_rootdev = $cr_dev_list)" + verbose "Setting up array ($cr_rootdev = $cr_dev_list)" [ "$cr_rootdev" = "/dev/md0" ] && do_md0=0 @@ -183,10 +179,17 @@ initrd_gen_md() { done done - echo "mdassemble" | add_linuxrc + echo "wait_for_files $cr_dev_list" | add_linuxrc + add_linuxrc <<-'EOF' + /sbin/mdadm --assemble --scan + + if [ "$DEBUGINITRD" ]; then + [ -e /proc/mdstat ] && echo "/proc/mdstat contents:" && cat /proc/mdstat + fi + EOF # needed to determine md-version if [ "$do_md0" -eq 1 ]; then - mknod $DESTDIR/dev/md0 b 9 0 + mknod -m 660 $DESTDIR/dev/md0 b 9 0 fi }