You are not logged in.

#1 2009-10-06 07:30:04

JSHN
Member
From: Sweden, Trollhättan
Registered: 2009-10-05
Posts: 12

How does the boot-process assemble the raid?

Hi everyone,

I just switched from Debian and CentOS to archlinux on all my machines and I really love it so far!
Now I feel that I can really customize my OS the way I want.

But I was thinking about one thing that I don't really understand yet, and of what I have
read on this forum I'm certain that someone knows the answer.

On my primary machine I have an mdadm-raid.
And the partitions looks like this:

/dev/sda                          /dev/sdb
Disk1                              Disk2

/dev/sda1                        /dev/sdb1
100mb ext2 (boot)            100mb empty (I did empty partition so that the disks looks the same.)

/dev/sda2  <- RAID0 ->   /dev/sdb2            /dev/md0
2500MB ext3 (root)          2500MB ext3

/dev/sda3  <- RAID0 ->   /dev/sdb3            /dev/md1
2250MB (swap)                2250MB swap

/dev/sda4  <- RAID0 ->   /dev/sdb4            /dev/md2
245150MB ext3 (home)    245150MB ext3

So there was a little tricky to get it installed and assemble the raid at boot, but now it's working like a dream again.

And what I did what except loading mdadm-hook of course I used the kernel parameter: ro root=/dev/md0 md=0,/dev/sda2,/dev/sdb2 a.s.o. to
tell the initrd how to assemble the raid at boot.

But before archlinux i've done this setup in the installer, and after I've installed for example Debian, the system boots correctly and
assemble the raid at boot, but without the kernel-parameters, how does the system know how the raid should be assembled?
I've tried to include the mdadm.conf but with no success, does the initrd contain the raid information is some way?

Offline

#2 2009-10-06 07:56:54

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: How does the boot-process assemble the raid?

What HOOKS are you using in your /etc/mkinitcpio.conf file?

And welcome to Arch smile

Offline

#3 2009-10-06 08:26:16

JSHN
Member
From: Sweden, Trollhättan
Registered: 2009-10-05
Posts: 12

Re: How does the boot-process assemble the raid?

fukawi2 wrote:

What HOOKS are you using in your /etc/mkinitcpio.conf file?

And welcome to Arch smile

Thanks! smile

I'm using: HOOKS=(base udev autodetect pata sata mdadm filesystems)

And without using the kernel-parameters I specified, the initrd cannot assemble my raid.

Offline

#4 2009-10-06 18:49:13

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: How does the boot-process assemble the raid?

Perhaps you should run:

mdadm -D /dev/md(x)
mkinitcpio -p kernel26

The codes herein are the required procedure to establish initramfs data for enabling mdadm to be assembled in the initrd sequence.

Perhaps you should try this (again)?

EDIT:  The code to install the raid data in /etc/mdadm.conf is as follows:

mdadm -D --scan >> /etc/mdadm.conf

I made an oops with the first code entry in this post.  Follow this edited code with:

mkinitcpio -p kernel26

Last edited by lilsirecho (2009-10-12 15:56:12)


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#5 2009-10-06 20:09:37

JSHN
Member
From: Sweden, Trollhättan
Registered: 2009-10-05
Posts: 12

Re: How does the boot-process assemble the raid?

lilsirecho wrote:

Perhaps you should run:

mdadm -D /dev/md(x)
mkinitcpio -p kernel26

The codes herein are the required procedure to establish initramfs data for enabling mdadm to be assembled in the initrd sequence.

Perhaps you should try this (again)?

Thanks for your reply!

Of what I can see is that "mdadm -D /dev/md(x)" just prints the details for the array, and "mkinitcpio -p kernel26"
recreates the ramdisk as default, as it was created during the installation. Can you maybe explain what is going
to happend differently this time, or am I missing something that will be added? hmm

Offline

#6 2009-10-06 20:25:26

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: How does the boot-process assemble the raid?

Perhaps there was a typo in the intial use of the mdadm install procedure......................?

Performing it again is to ensure it is correctly done for whatever reason.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#7 2009-10-06 21:16:09

JSHN
Member
From: Sweden, Trollhättan
Registered: 2009-10-05
Posts: 12

Re: How does the boot-process assemble the raid?

lilsirecho wrote:

Perhaps there was a typo in the intial use of the mdadm install procedure......................?

Performing it again is to ensure it is correctly done for whatever reason.

Ok I see, I'll try that, thanks!

Offline

#8 2009-10-06 21:59:21

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: How does the boot-process assemble the raid?

JSHN wrote:

I'm using: HOOKS=(base udev autodetect pata sata mdadm filesystems)

You can see what the 'mdadm' hook is doing in this file I believe:
/var/abs/core/mdadm/mdadm_hook

Offline

#9 2009-10-07 16:10:56

JSHN
Member
From: Sweden, Trollhättan
Registered: 2009-10-05
Posts: 12

Re: How does the boot-process assemble the raid?

fukawi2 wrote:
JSHN wrote:

I'm using: HOOKS=(base udev autodetect pata sata mdadm filesystems)

You can see what the 'mdadm' hook is doing in this file I believe:
/var/abs/core/mdadm/mdadm_hook

Unfortunately I don't have that file on on my installation. neutral

Offline

#10 2009-10-07 16:38:41

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: How does the boot-process assemble the raid?

To obtain that file, run:

abs

This will provide the abs tree of core,extra, and community in /var/abs.

Then you can get the file:

# vim: set ft=sh:
run_hook ()
{
    input="$(cat /proc/cmdline)"
    mdconfig="/etc/mdadm.conf"
    # for partitionable raid, we need to load md_mod first!
    modprobe md_mod 2>/dev/null
    # if no config file is present create one from command line parameters
    if ! [ -e $mdconfig ]; then
        #Create initial mdadm.conf
        # scan all devices in /proc/partitions
        echo DEVICE partitions > $mdconfig
        for i in $input; do
        case $i in
                # raid
                md=[0-9]*,/*)
                    device="$(/bin/replace -s,/ "$i" "=" "")"
                    array="$(/bin/replace -s/ "$device" "," " devices=")"
                    echo "ARRAY /dev/$array" >> $mdconfig
                    RAID_FOUND=1
                    ;;
                # partitionable raid
                md=d[0-9]*,/*)
                    device="$(/bin/replace -s=d "$i" "md=" "md_")"
                    array="$(/bin/replace -s/ "$device" "," " devices=")"
                    echo "ARRAY /dev/$array" >> $mdconfig
                    RAID_FOUND=1
                    ;;
                # raid UUID
                md=[0-9]*,[0-9,a-z]*)
                    device="$(/bin/replace -s,/ "$i" "=" "")"
                    array="$(/bin/replace -s/ "$device" "," " uuid=")"
                    echo "ARRAY /dev/$array" >> $mdconfig
                    RAID_FOUND=1
                    ;;
                # partitionable raid UUID
                md=d[0-9]*,[0-9,a-z]*)
                    device="$(/bin/replace -s=d "$i" "md=" "md_")"
                    array="$(/bin/replace -s/ "$device" "," " uuid=")"
                    echo "ARRAY /dev/$array" >> $mdconfig
                    RAID_FOUND=1
                    ;;
            esac
        done
    else
        RAID_FOUND=1
    fi
    if [ "$RAID_FOUND" = 1 ]; then
        # assemble everything
        /sbin/mdassemble.static
    fi
}

The above is what is provided in mine............


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#11 2009-10-07 22:09:51

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: How does the boot-process assemble the raid?

JSHN wrote:

Unfortunately I don't have that file on on my installation. neutral

Ah, sorry... As lilsirecho mentioned, you'll need to run 'abs' to pull the latest ABS tree from the Arch server:
http://wiki.archlinux.org/index.php/ABS … ild_System

Offline

#12 2009-10-07 22:16:35

JSHN
Member
From: Sweden, Trollhättan
Registered: 2009-10-05
Posts: 12

Re: How does the boot-process assemble the raid?

Thank you so much, that is what I have been looking for!

I'll get back when I've got it working.

Offline

#13 2009-10-08 03:21:50

Vamp898
Member
Registered: 2009-01-03
Posts: 1,032
Website

Re: How does the boot-process assemble the raid?

maybe want to use

abs --tarball

Offline

Board footer

Powered by FluxBB