# how to get a raid0 initrd

## soya

Hi, i'm trying to boot Gentoo on a raid0 partition scheme. i'm going to explain the steps i took to create the array.

Obviusly pluged two identical sata disks into ich10r so i'm not using jmicron superspeed asus feature (mobo is an Asus P6T) , went into bios settings  and seted raid mode, save and reboot and created the array through ctrl+l bios menu. After that i could install Windows without problems. Then pluged sysrescuecd usb pendrive and fromm boot screen typed "rescue64 dodmraid" so i could partition the disk using gparted without problems, after that i installed Gentoo and now i'm trying to boot it up.

Right now i can see this partition scheme when i'm at sysrescuecd prompt:

```
# ls /dev/mapper/ -l

total 0

lrwxrwxrwx 1 root root     16 abr  1 15:35 control -> ../device-mapper

brw-r----- 1 root disk 253, 0 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID0

brw-r----- 1 root disk 253, 1 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID01 <unused boot partition, using grub from another dev>

brw-r----- 1 root disk 253, 2 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID02 <ntfs partition>

brw-r----- 1 root disk 253, 3 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID05 <swap space,which i really don't need>

brw-r----- 1 root disk 253, 4 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID06 <system root partition "/">

brw-r----- 1 root disk 253, 5 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID07 <root's home partition>

brw-r----- 1 root disk 253, 6 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID08 <home partition>

brw-r----- 1 root disk 253, 7 abr  1 15:35 isw_cfccfdiidi_geaGB_RAID09 <portage partition>

```

As i want to to boot multiple SO i think the best choice for me is to make use of an initrd and dodmraid option at kernel line, so i emerged dmraid and mdadm, mdadm i don't know if i really need it. I also gave raid0 support to the kernel and built in the kernel the ICH10R needed drivers as explained here https://forums.gentoo.org/viewtopic-p-4570091.html#4570091 Right now i'm trying to make use of an initrd image to be able to boot Gentoo. 

I've tried a script from here http://www.gentoo-wiki.info/HOWTO_Install_Gentoo_with_NVRAID_using_dmraid#The_Hard_Solution_.28Using_A_Self-Built_Kernel.29 but i was getting an error so i really don't know how i'm supposed to create the needed initrd . I've found lots of "howtos" where people explain how to create arrays but i could not find the initrd method anywhere.

Please does someone know how should i proceed to boot into Gentoo form a initrd image? I really would avoid using genkernel to do the job. Thanks in advanced  :Smile: 

----------

## richard.scott

 *soya wrote:*   

> I really would avoid using genkernel to do the job.

 

That's a shame as if you used Genkernel it would be done by adding the "dmraid" option.

Why do people think that genkernel is the hard way?.... for Gentoo genkernel is the easy way!

I can't find a single reason to roll my own kernel anymore.

Rich.

----------

## soya

Hi, first of all thanks a lot for the reply  :Smile: 

Then i think you misunderstood something, genkernel is the easy way and Gentoo freaks/tuners want to avoid it in favor of getting a small an tuned kernel image.

No one has a Gentoo raid0 setup using an initrd? of course, without using genkernel :'(

Please i hope someone can help.

----------

## danomac

I'm using raid1+0, but I'm also using genkernel.

You can set genkernel to pop up menuconfig. Do that, and remove all the cruft you don't need, and build in the stuff you do need (or just build modules.) I did this and removed almost all the unnecessary stuff and wind up with a kernel almost identical to a manual kernel.

On the plus side it will generate the initrd for you. Just because you use genkernel doesn't mean you lose flexibility configuring the kernel.

----------

## richard.scott

See that's what I don't get... After you've spent hours writing your custom scripts to make your custom kernel you still end up with the same result... a kernel no?

Just out of interest, what do you class as a small kernel after you've tweaked it to your liking?

The raid your talking about looks to be using motherboard/bios raid and this is known as dmraid (AFAIK).

From what I can gather it needs modules loaded at boot time to assemble it.

Rich

----------

## danomac

 *richard.scott wrote:*   

> See that's what I don't get... After you've spent hours writing your custom scripts to make your custom kernel you still end up with the same result... a kernel no?

 

Are you talking to me now? I can't tell. It doesn't take me hours to configure a kernel. 5-10 minutes maybe, not hours.

 *richard.scott wrote:*   

> Just out of interest, what do you class as a small kernel after you've tweaked it to your liking?

 

A kernel that's less complex. I don't upgrade kernels often, unless I need new hardware functionality or there's a security issue. With a tweaked kernel you can avoid a lot of security issues as you do not necessarily have the issue as you do not have it compiled in the kernel. There's lots of reasons to customize your kernel: for me speed and image size are at the very bottom of the list. There's also been times where modules in the kernel conflict with each other. 

I guess it's whatever floats your boat. I see no need to have extra stuff in the kernel if I'll never use it. Compile times are less without the extra stuff. The chances for me having to do a forced upgrade due to bugs are a lot less as well. And on and on.

 *richard.scott wrote:*   

> The raid your talking about looks to be using motherboard/bios raid and this is known as dmraid (AFAIK).
> 
> From what I can gather it needs modules loaded at boot time to assemble it.

 

Yes, dmraid must be built in the initrd. Or your system will freak out when the kernel tries to load.

----------

## soya

Hi again, i'm not trying to generate an open discussion about genkernel image Vs non genkernel image. I understand a lot of people want to use genkernel due to its ease of use, to avoid confusion and problems like the one i'm in. But there are also a lot of people who prefer using mandriva, opensuse and so called products to avoid problems and to get a ready to use GNU/Linux system. For me it all is ok, it's just about preferences.

Right now i'm using Gentoo and i would like to make use of a non Genkernel image with a dmraid initrd, so as i'm not an openbsd hacker/developer nor a similar guru/geek (but it must be funny) i just need a bit of help in the case what i'm asking to do can be done.

Thanks again  :Smile: 

PD: I'm not sure at all but i think genkernel does not work with reiser4, which is my root fs, so i'm stack at this point. :'(

----------

## soya

Hi, i've been doing a bit of research and found i don't need the "famous" initrd image if grub is installed in a non raid device, am i right? i  ned to set raid partitions to autodetect mode am i right? Is there any guide where i can see how to set partitions in autoadetect? Thanks again  :Smile: 

----------

## DirtyHairy

Autodetection only works for true linux software RAIDs; you can find information about it here: http://linux-raid.osdl.org/

If you are using a RAID setup in the BIOS, it most likely a software aka fake RAID and needs dm-raid to work; you have to use an initrd then: http://linux-ata.org/faq-sata-raid.html

----------

## justinkb

surely the genkernel pitch was an april 1st joke  :Wink: 

----------

## danomac

 *justinkb wrote:*   

> surely the genkernel pitch was an april 1st joke 

 

No, genkernel really is the easiest way to create an initrd. The OP already tried making one by hand.

soya:

If you are not booting from the RAID array you don't need an initrd. All you need is dmraid support in the kernel and it should find it for you. Also, you seem to be mixing up linux kernel RAID and fakeraid. You're using the fakeraid (fakeraid devices show up in /dev/mapper/) so the autodetect stuff doesn't apply; that is only for kernel raid.

If you are booting from the fakeraid you will need an initrd with dmraid support. It's very easy to do with genkernel. I also tried the manual way and gave up. It just didn't work right. I might try it again later, though... if I have time - right now I don't.

----------

## soya

Hi, thanks to all for your replies  :Smile: 

Right now i've created an initrd image using genkernel so i could boot with no problem, but i would like to:

* First, boot without initrd as long as i'm not booting from a boot's raid partition. In my Gentoo installation i've emerged dmraid and mdadm (do i really need mdad? what is it supposed to do?). So to boot from a non raid partition all i need is a proper kernel image adapted to my hardware, dmraid tools and raid support inside my kernel isn't it? That are the steps i'm going to follow to boot from a non raid partition, if i'm missing anything please tell it to me  :Smile: 

* Create a self image as the one created by genkernel is very big and uses autodetection at boot time and i would like to avoid it, anyway i would liketo learn how to create an initrd image without using genkernel.

Another question is, what is init=/linuxrc supposed to do at kernel line? i could boot up without that parameter which i don't knwo what it does and i also doesn't have de linuxrc file.

Please i hope you could help to clear up this points, thanks to all for the interest  :Smile: 

----------

## NeddySeagoon

soya,

You don't need mdadm, its for managing kernel raid sets and you are not using kernel raid.

You cannot boot into a root on dmraid volume without an initrd, as dmraid is essential to the process and it cannot be built into the kernel.

Here is a background sketch. Of kernel raid and dmraid.  

First kernel raid.

You make your partitions on your drives and use mdadm to form the partitions (usually on different spindles) into raid sets. The kernel manages the raid sets for you, once its loaded. Grub knows nothing of raid, so it fails on anything other than raid1, where you have multiple copies of the same image. It reads from only one platter.

dmraid

Your BIOS makes the multiple drives appear as a single volume, when grub reads blocks to load the kernel, the BIOS hides the data layout on the raid set, so grub just works. The kernel is not so lucky. It needs the dmraid package to find and mount its root filesyestm. Therefore you must have an initrd, since dmraid cannot be made in the kernel. The initrd is a temporary root filesystem, where you can put things you need (like dmraid) to mount the real root filesystem.

Windows vista has a feature called dynamic disks. This feature can be used to make software raid (not dmraid) volumes in windows, which can also be shared with linux.

----------

## soya

Hi, thanks a lot for the explanation. It's very clarifying.  :Smile: 

As for the initrd file matter, is there any process i can follow to create an initrd file?

Thanks for all  :Smile: 

----------

## NeddySeagoon

soya,

You can let genkernel do it for you, you can rip out the initrd building script from genkernel and make it stand alone or you can follow any one of the recipies on the internet. /usr/src/linux/Documentation/initrd.txt is also worth reading.

I don't use an initrd, so  I don't know the detail.

----------

## soya

Thanks for the reply gonna take a look at the initrd.txt  :Smile: 

----------

## chrisyu

I'm using intel ich9r fake raid 0 now, build initrd with genkernel.

```

genkernel --dmraid --install --disklabel --kernel-config=/usr/src/linux/myconfig --makeopts=-j5 all --bootloader=grub

```

Good luck.

----------

## soya

That's what i did, tonight will give initrd.txt a read so i could try to build it myself. Thanks anyway  :Smile: 

----------

## natros

here is what i'm using

```
$ cat /usr/local/bin/build-kernel

#!/bin/sh

. /etc/make.conf

genkernel \

    --menuconfig \

    --save-config \

    --no-clean \

    --splash \

    --splash=livecd-2007.0 \

    --splash-res=1280x1024 \

    --makeopts=${MAKEOPTS} \

    --install \

    --dmraid \

    --disklabel \

    all

```

----------

## pelelademadera

could someone how to do, step by step.

i've an abit ip35-pro, same as natros. i want to do a raid with 2x500, 320gb for linux, 50gb for win2, and the rest for the data.... how can I do it without genkernel, using raid setup from bios.... i make the 3 units, and i cant make that gentoo recognized it. only can do from the livecd with dodmraid option.

```

pelo-pc pelo # dmraid -s

*** Group superset isw_bgedcbeaaf

--> Subset

name   : isw_bgedcbeaaf_linux

size   : 671088640

stride : 256

type   : stripe

status : ok

subsets: 0

devs   : 2

spares : 0

--> Subset

name   : isw_bgedcbeaaf_windows

size   : 1282439168

stride : 256

type   : stripe

status : ok

subsets: 0

devs   : 2

spares : 0

pelo-pc pelo # dmraid -ay

RAID set "isw_bgedcbeaaf_linux" was not activated

RAID set "isw_bgedcbeaaf_windows" was not activated

ERROR: device "isw_bgedcbeaaf_linux" could not be found

ERROR: device "isw_bgedcbeaaf_windows" could not be found
```

i booted gentoo from a third disk.

thanks

EDIT:

SOLVED.... forgot to copy bzimage to /boot directory

thanks anyway

----------

