# [Solved]Unable to boot mdadm raid0

## 6thgenA34

I was able to setup raid0 with slackware and archlinux. Arch linux raid was working but I couldn't makepkg since there was a strip object error. No one over @ arch forums where able to help me, or didn't know how to fix the error. So I decided I have time right now to try Gentoo. I been following the x86 handbook and  Gentoo raid wiki & Linux 101 gentoo raid. I finished following all the guide but I get a Could not find the root block device in

Partition layout

sd[ab]1         boot               ext2                       100MB

sd[ab]2                              swap                      2048mb

sd[ab]3         root               Linux raid               25000MB     ------->md0

sd[ab]4         VM                Linux raid               72000MB     ------->md1

mdadm v3.1.4

cat /proc/mdstat

 *Quote:*   

> 
> 
> Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
> 
> md1 : active raid0 sda4[0] sdb4[1]
> ...

 

I was unable to cat /proc/mdstat within the linux shell. I booted off the live cd and stopped the random /dev/md*. I used the assemble cmd in mdadm to bind them back.

/etc/fstab

 *Quote:*   

> /dev/sda1                 /boot            ext2                 noauto,noatime 1 2
> 
> /dev/md0                            /                  ext4                  noatime           0 1
> 
> /dev/sda2                           none             swap                 sw,pri=1          0 0
> ...

 

/boot/grub/menu.lst

 *Quote:*   

> default 0
> 
> timeout 30
> 
> splashimage=(hd0,0)/boot/grub/splash.xpm.gz
> ...

 

Option I used for genkernel "genkernel --splash --install --no-clean --menuconfig all" I went in and disable drivers I didn't use nics,wifi,atm,etc.. Made sure all the SCSI and RAID options when * and not M. After I ran "make && make modules_install" to create a kernel without genkernel, & cp to /boot . My thinking was if the genkernel did not boot I could use the other kernel without initrd to boot fine. 

Made sure that 

 *Quote:*   

> (chroot) # emerge mdadm
> 
> (chroot) # rc-update add mdadm boot

 

There is a section is the gentoo wiki that says if the /dev/md0 change to random numbers  try to update grub & fstab with new md*, plus mdadm --detail --scan >> /mnt/gentoo/etc/mdadm.conf which I did.. No dice. Also I stopped and rebind them to their normal md*.  If any one could point out what i'm missing it will help out a lot.. I tried installing it twice all ready,thinking I missed some cmd or option...thankxLast edited by 6thgenA34 on Sun Mar 11, 2012 10:06 pm; edited 1 time in total

----------

## eccerr0r

First off, BIOS handles boot, bios does not understand mdadm partitions.

The only way to boot is to make a small raid1 (or unraided) boot partition that will load the kernel.

Then after loading the kernel, the kernel needs to find the root partition.  If it requires mdadm on the root partition, this won't work.  It needs to be able to autodetect the partitions.  As the kernel boot scrolls by, does the kernel find your RAID0 array?

For my 4-disk RAID5 machines, I have a 4-disk small raid1 partition that contains grub and the kernel.  For one of my raid5s, the kernel has options set to autodetect the raid and root is set to that partition.

The other one I have an initrd to set up the RAID...this is the tougher way to set things up but now I have root on LVM on RAID5...

----------

## 6thgenA34

sda1(boot) and sda2(swap) are not in a raid. Only the root(sda3) and vm(sda4) are raid0. I do see raid modules being loaded in the scroll. The modules I see are related to sata, scsi, dm-mod,dm-mirror, dm-crypt,dm-snapshot,raid10

----------

## NeddySeagoon

6thgenA34,

```
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 

md1 : active raid0 sda4[0] sdb4[1] 

142354432 blocks super 1.2 512k chunks 

md0 : active raid0 sda3[0] sdb3[1] 

4881920 blocks super 1.2 512k chunks
```

Tells that you have allowed mdadm to use raid superblock version 1.2.

The kernel cannot autoassemble such raids. You would need to force the use of raid superblock 0.9 to use autoassemble.

You must use the initrd to assemble your root filesyarem before it can be mounted.

genkernel can organise such an initrd for you but as genkernel is a source of more problems than it fixes, I don't reccomend its use.

```
man genkernel 
```

  may tell you how to run it to set up the initrd the way you need. Its not --dmraid anyway.  Thats for fakeraid.

If there is no manpage, genkernel --help is worth a try.

----------

## 6thgenA34

I created both raid0 with 0.90 metadata instead of the default 1.2. I got rid of the genkernel approach and stuck to manual method to build kernel.  I tried to boot from livecd to copy the log files but I don't see them in the dir. 

kernel boot txt

 *Quote:*   

> md: bind <sda3>
> 
> md: bind <sdb3>
> 
> md: running : <sdb3><sda3>
> ...

 

grub.conf

 *Quote:*   

> root (hd0,0)
> 
> kernel /boot/kernel-3.2.1-gentoo-r2 root=/dev/md0

 

From what I can figure out is now that it can read md0 but can't recognition the filesystem right? Also the way i formated the raid was "mkfs.ext4 /dev/md0" no other options or tweaks.

update

Got it working with genkernel –mdadm –menuconfig all and adding domdadm to the grub config file. Now my question is how can I do the same with the custom kernel?

----------

## NeddySeagoon

6thgenA34,

That all looks good

```
.VFS: Mounted root (ext4 filesystem) readonly on device 9:0 
```

device 9:0  is /dev/md0 - See /usr/src/linux/Documentation/devices.txt

Your kernel assembled your md0 and mounted the root filesystem read only - which is correct.

It gets remounted read/write after the filesystem has been checked.

Whatever went wrong, it was after root was mounted.  What was your error message?

Check that your have ext4 in the root entry in /etc/fstab.

----------

## 6thgenA34

devices.txt

 *Quote:*   

>  9 block       Metadisk (RAID) devices
> 
>                   0 = /dev/md0          First metadisk group
> 
>                   1 = /dev/md1          Second metadisk group
> ...

 

error mesg

 *Quote:*   

> md: bind <sda3>
> 
> md: bind <sdb3>
> 
> md: running : <sdb3><sda3>
> ...

 

Thats all I get. It freeze right there. I tired booting off the livecd to try to recover the logs files but they don't show up. I don't have a problem booting with my genkernel. 

fstab file

 *Quote:*   

> /dev/sda1		/boot		ext2		noauto,noatime	1 2
> 
> /dev/md0		/		ext4		noatime		0 1
> 
> /dev/sda2		none		swap		sw,pri=1	0 0
> ...

 

mount cmd within genkernel boot

 *Quote:*   

> rootfs on / type rootfs (rw)
> 
> proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
> 
> sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
> ...

 

I don't mine having to boot with the genkernel. But I want to speed up my boot time. I used the genkernel initrd with the custom kernel and it works. But for some reason I can't find mkinitrd with emerge. Since I just want to make a basic initrd with raid support.

----------

## NeddySeagoon

6thgenA34,

Two things come to mind.

Either your init script is not running, so it really stops there or the screen goes blank but the boot continues.

The latter is possible because the kernel contains two console drivers and its not an error to leave them both out. That gives you black tect on a black background, which is hard to read but everything else still works.

Post your /boot/grub/grub.conf so we can check your init= statement, if you have one - none is needed unless you use an initrd.

Pastebin your kernel .config file so we can have a look at your console support.

----------

## 6thgenA34

http://pastebin.com/LA9wFxfD

grub.conf

 *Quote:*   

> default 0
> 
> timeout 30
> 
> splashimage=(hd0,0)/boot/grub/splash.xpm.gz
> ...

 

Normally I boot with the initrd commented out for 3.2.1 kernel. Thats when it wont boot properly.Got it to work with the genkernel initrd.

----------

## NeddySeagoon

6thgenA34,

Very close

```
title Gentoo Raid 

root (hd0,0) 

kernel /boot/kernel-genkernel-x86-3.2.1-gentoo-r2 root=/dev/ram0 real_root=/dev/md0 md=0,/dev/sda3,/dev/sdb3 vga=791 

domdadm 

initrd /boot/initramfs-genkernel-x86-3.2.1-gentoo-r2 
```

The domdadm needs to be on the kernel line, or that newline an artefact of the forums and your post ?

----------

## 6thgenA34

I spent to much time trying to make it to work without initrd. I'm just going to stick with the genkernel setup. I need to focus on the other issues I might have trying to setup gentoo.Thanks for the help

----------

## NeddySeagoon

6thgenA34,

kernel-seeds.org is a good place to start for a basic kernel and an explaination of the options you need.

----------

