Bug 82513 - RFE: make rc.sysinit use mdadm in addition to raidstart
Summary: RFE: make rc.sysinit use mdadm in addition to raidstart
Alias: None
Product: Red Hat Public Beta
Classification: Retired
Component: initscripts
Version: phoebe
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On:
Blocks: 79579
TreeView+ depends on / blocked
Reported: 2003-01-22 22:59 UTC by James Ralston
Modified: 2014-03-17 02:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2003-03-18 08:27:24 UTC

Attachments (Terms of Use)

Description James Ralston 2003-01-22 22:59:44 UTC
Per traffic on the linux-raid mailing list, the raidtools package is
more-or-less considered to be legacy at this point; the mdadm tool is the
current recommended RAID administrative tool.

Yet /etc/init.d/rc.sysinit has support for only raidtools.  E.g., if there is no
/etc/raidtab file, but there *is* a /etc/mdadm.conf file, RAID startup doesn't

The current logic (simplified) is this:

  if [ -f /etc/raidtab ]; then
    # try to start up RAID using /sbin/raidstart

I propose that the logic be changed to:

  if [ -f /etc/raidtab ]; then
    # try to start up RAID using /sbin/raidstart
  elsif [ -f /etc/mdadm.conf ]; then
    # try to start up RAID using /sbin/mdadm --assemble --scan

(Until the raidtools package is removed from the distribution,
/etc/rc.d/rc.sysinit still needs to look for the /etc/raidtab file.)

I'm going to go make rc.sysinit on my 8.0 box smart enough to do this, so I can
give you a patch to implement the above logic shortly.

Comment 1 Bill Nottingham 2003-01-23 05:34:07 UTC
How often do you have not-autodetected raid arrays, out of curiousity?

Comment 2 Bill Nottingham 2003-01-23 05:35:10 UTC
Hm, doing this right would also involve adding support to mkinitrd, etc., etc.

Comment 3 James Ralston 2003-01-27 04:03:21 UTC
Actually, I've *never* been able to get my arrays to automatically start on
Psyche using mdadmin.  That's why I filed this enhancement request for Phoebe.

I have a Psyche system with 3 SCSI disks.  The first disk is a (non-RAID) system

Disk /dev/sda: 255 heads, 63 sectors, 2213 cylinders

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1             1      2213  17775891    5  Extended
/dev/sda5             1       261   2096419+  82  Linux swap
/dev/sda6   *       262      1828  12586896   83  Linux

I want to use the remaining two disks to make a /data partition:

Disk /dev/sdb: 255 heads, 63 sectors, 4427 cylinders
Disk /dev/sdc: 255 heads, 63 sectors, 4427 cylinders

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1        33    265041   fd  Linux raid autodetect
/dev/sdc1             1        33    265041   fd  Linux raid autodetect

So, I create a new mirror:

    $ mdadm --create /dev/md0 --verbose --level=mirror --raid-devices=2
/dev/sdb1 /dev/sdc1

I wait for the mirror to sync, and then check its status:

    $ cat /proc/mdstat
    Personalities : [raid1]
    read_ahead 1024 sectors
    md0 : active raid1 sdc1[1] sdb1[0]
          264960 blocks [2/2] [UU]
    unused devices: <none>

Then I update /etc/mdadm.conf:

    $ mdadm --examine --scan >>/etc/mdadm.conf

And clean it up slightly:

    $ cat /etc/mdadm.conf
    DEVICE /dev/sdb[1234]
    DEVICE /dev/sdc[1234]
    ARRAY /dev/md0

Now, I reboot the machine.  After the machine comes back up, I login and run:

    $ cat /etc/mdadm.conf
    Personalities :
    read_ahead not set
    unused devices: <none>

I can manually modprobe the raid1 module, but it won't start the array:

    $ modprobe raid1
    Personalities : [raid1]
    read_ahead not set
    unused devices: <none>

The only way I can get the array to start up is to run mdadmin:

    $ mdadm --assemble --scan
    mdadm: /dev/md0 has been started with 2 drives.

Was (autodetecting and autostarting arrays created via mdadmin at system boot
time) already supposed to work in Psyche and/or Phoebe?

Comment 4 Bill Nottingham 2003-01-27 17:33:07 UTC
What happens if you do:

modprobe raid1
raidautorun /dev/md0 (in nash)


Comment 5 James Ralston 2003-01-27 22:48:46 UTC
Success--the "raidautorun /dev/md0" command in nash automatically starts the array.

(I tested both with and without running modprobe first; AFAICT, the modprobe
command is superfluous.)

Comment 6 James Ralston 2003-03-11 23:54:12 UTC
An update: I tested this some more under Phoebe (8.0.94), and it appears to do
the right thing: the arrays are started up when the kernel performs autodetection.

Unfortunately, it's not obvious that for autodetection to work, the initrd image
has to contain the appropriate md modules (e.g. raid1).  This will be the case
if a user sets up md devices during installation, of course, but if no devices
are created during the installation, and md devices are later created, mkinitrd
must be re-run in order to update the initrd image with the appropriate md modules.

Perhaps the "you'll need to re-run mkinitrd if you change your md configuration"
requirement should be mentioned in the release notes?

Comment 7 James Ralston 2003-03-18 08:27:24 UTC
Since this appears to work, I'm closing with RESOLVED RAWHIDE.

I still think the release notes should mention that mkinitrd needs to be re-run
if any md devices are created/deleted after the system has already been installed.

Note You need to log in before you can comment on or make changes to this bug.