[CentOS] CentOS 6.2 on partitionable mdadm RAID1 (md_d0) - kernel panic with either disk not present

Wed Jun 20 04:35:36 UTC 2012
Arun Khan <knura9 at gmail.com>

On Wed, Jun 20, 2012 at 2:18 AM,  <m.roth at 5-cent.us> wrote:
> Rob Kampen wrote:
>> On 06/20/2012 07:23 AM, Arun Khan wrote:
>>> On Wed, Jun 20, 2012 at 12:11 AM,<m.roth at 5-cent.us>  wrote:
>>>> Arun Khan wrote:
>>>>>     Device Boot      Start         End      Blocks   Id  System
>>>>> /dev/sda1   *           1         523     4194304   83  Linux
>>>>> Partition 1 does not end on cylinder boundary.
>>>>> /dev/sda2             523        1045     4194304   83  Linux
>>>>> /dev/sda3            1045        1176     1048576   82  Linux swap /
>>>>> Solaris
>> raid needs Id of fd rather than 83 to auto detect??
> Good catch. A quick google got me a page on filesystem types, which had
> this line:
> fd Linux raid partition with autodetect using persistent superblock

But this is supposed to be RAID1 on the *entire* disks and not on the
individual partitions.

The instruction on the wiki clearly states do a "regular" install on
the first disk (I did leave a few blocks at the end of the first disk
as per the instructions) and then create a "partitionable" RAID1


<wiki quote>


Why would you want to have a system installed on a partitionable software RAID1?

If you are installing a system on a partitionable RAID you can use the
whole hard drive as a RAID component device, and since RAID1 is a
mirror, you will be able to boot your system from any of the drives in
case of failure without any additional tricks required to preserve
bootloader configuration, etc. And when you need to repair a failed
RAID volume with the whole hard drive as a RAID component, all you
have to do is to insert a new hard drive and run mdadm --add; no
partitioning or anything else required.


Steps for both CentOS 5 & 6

1. Install CentOS using standard installer on the first hard disk,
/dev/sda. Select manual partitioning during the installation, and
leave at least 1 unit at the very end of the disk unpartitioned. You
will be able to redeem most of this space back later. You need to
reserve this space for mdadm which stores it's metadata at the last
chunk of a raid volume.

2. Boot from the CentOS installation disk in the Rescue mode. The
installer will ask you if you wish to mount an existing CentOS
installation, you must refuse.

3. Build the software RAID1 using mdadm in degraded mode, with
/dev/sda as the only drive:
mdadm --create --metadata=0.90 --level=1 --raid-devices=2 /dev/md_d0
/dev/sda missing

4. Add the mirror drive /dev/sdb into the raid and check /proc/mdstat
to see that the raid started building:
mdadm --add /dev/md_d0 /dev/sdb
cat /proc/mdstat

</wiki quote>

-- Arun Khan