Re: Cannot auto assemble a raid1 array on boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 18 Oct 2012 09:19:58 -0600 Jivko Sabev <jsabev@xxxxxxxxxx> wrote:

> Hi,
> 
> The mdadm.conf in the initrd image contains the correct devices. I.e.
> the contents of mdadm.conf in initrd are the output of
> 
> mdadm --detail --scan
> 
> ARRAY /dev/md0 metadata=1.2 name=mercury:0
> UUID=60ea870e:029dcf99:eaae356e:f1c12085
> ARRAY /dev/md1 metadata=1.2 name=mercury:1
> UUID=d89a52ed:0247f2e8:5edf5d09:21e7fa48
> 
> However, the problem remains. That is when booting, the system dumps
> into initramfs shell with the raid array in an inactive state. I have
> to manually stop the array and then reassemble.
> 
> mdadm --manage --stop /dev/md1
> mdadm --assemble /dev/md1 /dev/sde1 /dev/md0
> 
> 
> At the point, I am able to continue booting and everything is fine after.
> 
> Here are the contents of /proc/mdstat from the initrd shell before
> reassembling the array.
> 
> md1 : inactive sde1[2](S)
>       976639672 blocks super 1.2
> 
> md0 : active linear sdb1[0] sdc1[1]
>       976770537 blocks super 1.2 0k rounding

There are two problems here.

Firstly, the fact that the array doesn't assemble completely should not cause
the boot to fail.  A degraded raid1 is perfectly sufficient for booting.

What is happening is that the initrd is relying on udev to assemble the array
by passing each new device to "mdadm --incremental $DEVNAME".
This will assemble the array as soon as all devices are present, but not
before.   If a device failed before shutdown that will be recorded in the
metadata and "mdadm --incremental" will not wait for it.  If it disappears
during reboot, mdadm will still expect it.

To deal with this issue, the initrd should run
  mdadm --incremental --scan --run

which means "look for all arrays that are being incrementally assembled, and
start them".
This should be called after running "udevadm settle" and before mounting the
root filesystem.

However fixing this won't fix your problem, it will just change it.

The udev rules files which is calling "mdadm --incremental" does so
on /dev/sdb1 /dev/sdc1 and /dev/sde1, but apparently not on /dev/md0.

If at the initrd shell prompt you run
  mdadm -I /dev/md0

it should finish assembling md1 for you.  For some reason udev isn't doing
that.

Have a look in /lib/udev/rules.d or /etc/udev/rules.d for a file that runs
"mdadm --incremental" or "mdadm -I" and see how it works.
Maybe post it.

BTW what distro are you using?

NeilBrown

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux