Linux – Cant boot newly created mdadm software raid in Debian linux squeeze

grublinuxmdadmsoftware-raid

Hello I have very strange problem creating swraid on Debian Squeeze Linux. I started creating RAID1 from existing standard instalation of Debian on single drive.
So I bought new drive and started following this tutorial:
http://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-system-incl-grub2-configuration-debian-squeeze

Everything went fine, i created initial raid from new drive. Then I successfully booted this new drive and added my old drive to this array. Old drive sucessfully synchronized in to raid. And after all setup I was ready for last reboot to my new Raid1 array.
But suddenly the drive array want boot. Grub takes very long to start (printing some error messages about fd0 read error). When I choose from menu debian starts loading very slowly and stops with message that md0 wasn't found. In grub shell I found that there is only /dev/md, no /dev/md0 or /dev/md1.

After many hours of trials i finnaly managed to get Raid working. Using ugky hack.

I had to add:

mdadm -A --auto=md /dev/md0

On the right place in:

/usr/share/initramfs-tools/init

and rebuild initrd.img of my kernel

This command starts my Raid and creates /dev/md0 and /dev/md1.

But its quiet ugly hack, and I dont think its very stable. Also it can break in future with some update.
So my question is why i need this change in init script? Is there something bad with my array? How to fix it?

Thanks for all hints. I'm quiet desperade now it took my all night (12 hours). to

Best Answer

Ok, so I found solution of my problem booting from mdadm Raid1. I'm quite ashamed that it took me so much time to figure this out, because it's a quite simple mistake.

In /etc/default/mdadm there was section:

# INITRDSTART:
#   list of arrays (or 'all') to start automatically when the initial ramdisk
#   loads. This list *must* include the array holding your root filesystem. Use
#   'none' to prevent any array from being started from the initial ramdisk.
INITRDSTART='none'

I had to chage it to :

INITRDSTART='all'

And then I could remove my custom command from /usr/share/initramfs-tools/init and linux boots without problems from my raid 1.