Bug 82513

Summary: RFE: make rc.sysinit use mdadm in addition to raidstart
Product: [Retired] Red Hat Public Beta Reporter: James Ralston <ralston>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: phoebeCC: katzj, mitr, rvokal
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-03-18 08:27:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 79579    

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

The current logic (simplified) is this:

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

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
  fi

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

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
        level=raid1
        num-devices=2
        devices=/dev/sdb1,/dev/sdc1
        UUID=d8aea89f:0261ca12:b9dec0d4:bd7752a3

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