Hello Guys,

Reading all of your post's helped me a lot understanding linux a little
be more, thanks for sharing your knowledge.

As I stated a few post above I've tried mdadm on Debian and it works the
just fine, so I compared the scripts in /usr/share/initramfs-
tools/scripts and found out they are not so diferent from the ones in
ubuntu but still there's a diference I wanned to share with you.

When you setup mdadm on debian, a mdadm file is created in /usr/share
/initramfs-tools/scripts/local-top,(I'll paste its contend below). The
scripts in this folder get called from the local script file (The one
you guys suggest to patch). And if you compare the debian version of the
local scrip, with ubuntu's version you'll find out its pretty similar.
So I guess this could be a better solution since for example you wont
have to wait 180 secs, and you don't include "intrusive" code in the
local script.

Here goes the debian version of the local script file
[code]
# Local filesystem mounting                     -*- shell-script -*-

# Parameter: Where to mount the filesystem
mountroot ()
{
        [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
        run_scripts /scripts/local-top
        [ "$quiet" != "y" ] && log_end_msg

        # If the root device hasn't shown up yet, give it a little while
        # to deal with removable devices
        if [ ! -e "${ROOT}" ]; then
                log_begin_msg "Waiting for root file system..."

                # Default delay is 180s
                if [ -z "${ROOTDELAY}" ]; then
                        slumber=180
                else
                        slumber=${ROOTDELAY}
                fi
                if [ -x /sbin/usplash_write ]; then
                        /sbin/usplash_write "TIMEOUT ${slumber}" || true
                fi

                slumber=$(( ${slumber} * 10 ))
                while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do
                        /bin/sleep 0.1
                        slumber=$(( ${slumber} - 1 ))
                done

                if [ ${slumber} -gt 0 ]; then
                        log_end_msg 0
                else
                        log_end_msg 1 || true
                fi
                if [ -x /sbin/usplash_write ]; then
                        /sbin/usplash_write "TIMEOUT 15" || true
                fi
        fi

        # We've given up, but we'll let the user fix matters if they can
        while [ ! -e "${ROOT}" ]; do
                echo "  Check root= bootarg cat /proc/cmdline"
                echo "  or missing modules, devices: cat /proc/modules ls /dev"
                panic "ALERT!  ${ROOT} does not exist.  Dropping to a shell!"
        done

        # Get the root filesystem type if not set
        if [ -z "${ROOTFSTYPE}" ]; then
                eval $(fstype < ${ROOT})
        else
                FSTYPE=${ROOTFSTYPE}
        fi
        if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then
                FSTYPE=$(/lib/udev/vol_id -t ${ROOT})
                [ -z "$FSTYPE" ] && FSTYPE="unknown"
        fi

        [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
        run_scripts /scripts/local-premount
        [ "$quiet" != "y" ] && log_end_msg

        if [ ${readonly} = y ]; then
                roflag=-r
        else
                roflag=-w
        fi

        # FIXME This has no error checking
        modprobe -q ${FSTYPE}

        # FIXME This has no error checking
        # Mount root
        mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}

        [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
        run_scripts /scripts/local-bottom
        [ "$quiet" != "y" ] && log_end_msg
}
[/code]

And here is the contend of the mdadm script file located in 
/usr/share/initramfs-tools/local-top folder
[code]
#!/bin/sh
#
# Copyright © 2006 Martin F. Krafft <[EMAIL PROTECTED]>
# based on the scripts in the initramfs-tools package.
# released under the terms of the Artistic Licence.
#
# $Id: script.local-top 290 2006-12-19 08:18:50Z madduck $
#

set -eu

PREREQ="udev_helper"

prereqs()
{
        echo "$PREREQ"
}

case ${1:-} in
  prereqs)
    prereqs
    exit 0
    ;;
esac

. /scripts/functions

if [ -e /scripts/local-top/md ]; then
  log_warning_msg "old md initialisation script found, getting out of its 
way..."
  exit 1
fi

MDADM=/sbin/mdadm
[ -x "$MDADM" ] || exit 0

verbose()
{
  case "$quiet" in y*|Y*|1|t*|T*)
    return 1;;
  *)
    return 0;;
  esac
}

MD_DEVS=all
MD_MODULES='linear multipath raid0 raid1 raid456 raid5 raid6 raid10'
[ -s /conf/md.conf ] && . /conf/md.conf

verbose && log_begin_msg Loading MD modules
for module in ${MD_MODULES:-}; do
  if modprobe --syslog "$module"; then
    verbose && log_success_msg "loaded module ${module}."
  else
    log_failure_msg "failed to load module ${module}."
  fi
done
log_end_msg

if [ ! -f /proc/mdstat ]; then
  verbose && panic "cannot initialise MD subsystem (/proc/mdstat missing)"
  exit 1
fi

# handle /dev/md/X nodes
mkdir --parent /dev/md

CONFIG=/etc/mdadm/mdadm.conf
# in case the hook failed to install a configuration file, this is our last
# attempt... the "emergency procedure"... <drumroll>
if [ ! -e $CONFIG ]; then
  log_warning_msg "missing mdadm.conf file, trying to create one..."
  mkdir -p ${CONFIG%/*}
  echo DEVICE partitions > $CONFIG
  $MDADM --examine --scan >> $CONFIG
  if [ -s $CONFIG ]; then
    verbose && log_success_msg "mdadm.conf created."
  else
    verbose && log_failure_msg "could not create mdadm.conf, the boot will 
likely fail."
  fi
  MD_DEVS=all
fi

if [ "$MD_DEVS" = all ]; then
  
  verbose && log_begin_msg "Assembling all MD arrays"
  extra_args=''
  [ -n "$MD_HOMEHOST" ] && \
    extra_args="--homehost='$MD_HOMEHOST' --auto-update-homehost"
  if $MDADM --assemble --scan --run --auto=yes $extra_args; then
    verbose && log_success_msg "assembled all arrays."
  else
    log_failure_msg "failed to assemble all arrays."
  fi
  verbose && log_end_msg

elif [ "$MD_DEVS" != none ]; then
  for dev in $MD_DEVS; do

    verbose && log_begin_msg "Assembling MD array $dev"
    if $MDADM --assemble --run --auto=yes $dev; then
      verbose && log_success_msg "started $dev"
    else
      log_failure_msg "failed to start $dev"
    fi
    verbose && log_end_msg

  done
fi

exit 0
[/code]

Hope this works, didn't have time nor PC to try this, but maybe someone
could give it a try :)

Kind Regards,

Diego Bendlin

-- 
cannot boot raid1 with only one disk
https://bugs.launchpad.net/bugs/120375
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to