public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ciprian Dorin, Craciun" <ciprian.craciun@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Re: initramfs & RAID at boot time
Date: Sun, 18 Apr 2010 09:57:38 +0300	[thread overview]
Message-ID: <j2m8e04b5821004172357sdcf62df9w6ea29c1ea89ea9cd@mail.gmail.com> (raw)
In-Reply-To: <20100417230107.71b44573@digimed.co.uk>

On Sun, Apr 18, 2010 at 1:01 AM, Neil Bothwick <neil@digimed.co.uk> wrote:
> On Sat, 17 Apr 2010 14:36:39 -0700, Mark Knecht wrote:
>
>> Empirically any way there doesn't seem to be a problem. I built the
>> new kernel and it booted normally so I think I'm misinterpreting what
>> was written in the Wiki or the Wiki is wrong.
>
> As long as /boot is not on RAID, or is on RAID1, you don't need an
> initrd. I've been booting this system for years with / on RAID1 and
> everything else on RAID5.


    From my research on the topic (I also wanted to have both /boot
and / on RAID1) there are the following traps:
    * there is an option for the kernel that must be enabled at
compile time that enables automatic RAID detection and assembly by the
kernel before mounting /, but it works only for MD metadata 0.96 (see
[1]);
    * the default metadata for `mdadm` is 1.2 (see `man mdadm`, and
search for `--metadata`), so when creating the RAID you must
explicitly select the metadata you want;
    * indeed the preferred may to do it is using an initramfs; (I've
posted below some shell snippets that create do exactly this: assemble
my RAID); (the code snippets are between {{{...}}}, it's from a
MoinMoin wiki page;)

    Also a question for about /boot on RAID1... I didn't manage to
make it work... Could you Neil please tell me exactly how you did
this? I'm most interested in how you've convinced Grub to work...

    Best,
    Ciprian.

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/md.txt;h=188f4768f1d58c013d962f993ae36483195fd288;hb=HEAD


==== Init-ramfs preparation ====

{{{
mkdir -p /usr/src/initramfs

cd /usr/src/initramfs

mkdir /usr/src/initramfs/bin
mkdir /usr/src/initramfs/dev
mkdir /usr/src/initramfs/proc
mkdir /usr/src/initramfs/rootfs
mkdir /usr/src/initramfs/sys

cp -a /bin/busybox /usr/src/initramfs/bin/busybox
cp -a /sbin/mdadm /usr/src/initramfs/bin/mdadm
cp -a /sbin/jfs_fsck /usr/src/initramfs/bin/jfs_fsck

cp -a /dev/console /usr/src/initramfs/dev/console
cp -a /dev/null /usr/src/initramfs/dev/null

cp -a /dev/sda2 /usr/src/initramfs/dev/sda2
cp -a /dev/sdc2 /usr/src/initramfs/dev/sdc2
cp -a /dev/md127 /usr/src/initramfs/dev/md127
}}}

{{{
cat >/usr/src/initramfs/init <<'EOS'
#!/bin/busybox ash

exec </dev/null >/dev/null 2>/dev/console
exec 1>&2

/bin/busybox mount -n -t proc none /proc || exit 1
/bin/busybox mount -n -t sysfs none /sys || exit 1

/bin/mdadm -A /dev/md127 -R -a md /dev/sda2 /dev/sdc2 || exit 1

/bin/jfs_fsck -p /dev/md127 || true

/bin/busybox mount -n -t jfs /dev/md127 /rootfs -o
ro,exec,suid,dev,relatime,errors=remount-ro || exit 1

/bin/busybox umount -n /sys || exit 1
/bin/busybox umount -n /proc || exit 1

# /bin/busybox ash </dev/console >/dev/console 2>/dev/console || exit 1

exec /bin/busybox switch_root /rootfs /sbin/init || exit 1

exit 1

EOS

chmod +x /usr/src/initramfs/init
}}}

{{{
( cd /usr/src/initramfs ; find . | cpio --quiet -o -H newc | gzip -9 >
/boot/initramfs )
}}}



  reply	other threads:[~2010-04-18  6:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-17 17:32 [gentoo-user] initramfs & RAID at boot time Mark Knecht
2010-04-17 21:36 ` [gentoo-user] " Mark Knecht
2010-04-17 22:01   ` Neil Bothwick
2010-04-18  6:57     ` Ciprian Dorin, Craciun [this message]
2010-04-18  7:42       ` Jarry
2010-04-19 11:16         ` Ciprian Dorin, Craciun
2010-04-18  8:16       ` Neil Bothwick
2010-04-19 11:27         ` Ciprian Dorin, Craciun
2010-04-19 11:51           ` Neil Bothwick
2010-04-18 15:13     ` Mark Knecht
2010-04-18 18:01       ` Neil Bothwick
2010-04-18 21:10         ` Mark Knecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=j2m8e04b5821004172357sdcf62df9w6ea29c1ea89ea9cd@mail.gmail.com \
    --to=ciprian.craciun@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox