Bug 82513 - RFE: make rc.sysinit use mdadm in addition to raidstart
RFE: make rc.sysinit use mdadm in addition to raidstart
Status: CLOSED RAWHIDE
Product: Red Hat Public Beta
Classification: Retired
Component: initscripts (Show other bugs)
phoebe
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
: FutureFeature
Depends On:
Blocks: 79579
  Show dependency treegraph
 
Reported: 2003-01-22 17:59 EST by James Ralston
Modified: 2014-03-16 22:33 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-03-18 03:27:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Ralston 2003-01-22 17:59:44 EST
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 00:34:07 EST
How often do you have not-autodetected raid arrays, out of curiousity?
Comment 2 Bill Nottingham 2003-01-23 00:35:10 EST
Hm, doing this right would also involve adding support to mkinitrd, etc., etc.
Comment 3 James Ralston 2003-01-26 23:03:21 EST
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 12:33:07 EST
What happens if you do:

modprobe raid1
nash
raidautorun /dev/md0 (in nash)

?
Comment 5 James Ralston 2003-01-27 17:48:46 EST
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 18:54:12 EST
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 03:27:24 EST
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.