1 |
On Sun, Apr 18, 2010 at 1:01 AM, Neil Bothwick <neil@××××××××××.uk> wrote: |
2 |
> On Sat, 17 Apr 2010 14:36:39 -0700, Mark Knecht wrote: |
3 |
> |
4 |
>> Empirically any way there doesn't seem to be a problem. I built the |
5 |
>> new kernel and it booted normally so I think I'm misinterpreting what |
6 |
>> was written in the Wiki or the Wiki is wrong. |
7 |
> |
8 |
> As long as /boot is not on RAID, or is on RAID1, you don't need an |
9 |
> initrd. I've been booting this system for years with / on RAID1 and |
10 |
> everything else on RAID5. |
11 |
|
12 |
|
13 |
From my research on the topic (I also wanted to have both /boot |
14 |
and / on RAID1) there are the following traps: |
15 |
* there is an option for the kernel that must be enabled at |
16 |
compile time that enables automatic RAID detection and assembly by the |
17 |
kernel before mounting /, but it works only for MD metadata 0.96 (see |
18 |
[1]); |
19 |
* the default metadata for `mdadm` is 1.2 (see `man mdadm`, and |
20 |
search for `--metadata`), so when creating the RAID you must |
21 |
explicitly select the metadata you want; |
22 |
* indeed the preferred may to do it is using an initramfs; (I've |
23 |
posted below some shell snippets that create do exactly this: assemble |
24 |
my RAID); (the code snippets are between {{{...}}}, it's from a |
25 |
MoinMoin wiki page;) |
26 |
|
27 |
Also a question for about /boot on RAID1... I didn't manage to |
28 |
make it work... Could you Neil please tell me exactly how you did |
29 |
this? I'm most interested in how you've convinced Grub to work... |
30 |
|
31 |
Best, |
32 |
Ciprian. |
33 |
|
34 |
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/md.txt;h=188f4768f1d58c013d962f993ae36483195fd288;hb=HEAD |
35 |
|
36 |
|
37 |
==== Init-ramfs preparation ==== |
38 |
|
39 |
{{{ |
40 |
mkdir -p /usr/src/initramfs |
41 |
|
42 |
cd /usr/src/initramfs |
43 |
|
44 |
mkdir /usr/src/initramfs/bin |
45 |
mkdir /usr/src/initramfs/dev |
46 |
mkdir /usr/src/initramfs/proc |
47 |
mkdir /usr/src/initramfs/rootfs |
48 |
mkdir /usr/src/initramfs/sys |
49 |
|
50 |
cp -a /bin/busybox /usr/src/initramfs/bin/busybox |
51 |
cp -a /sbin/mdadm /usr/src/initramfs/bin/mdadm |
52 |
cp -a /sbin/jfs_fsck /usr/src/initramfs/bin/jfs_fsck |
53 |
|
54 |
cp -a /dev/console /usr/src/initramfs/dev/console |
55 |
cp -a /dev/null /usr/src/initramfs/dev/null |
56 |
|
57 |
cp -a /dev/sda2 /usr/src/initramfs/dev/sda2 |
58 |
cp -a /dev/sdc2 /usr/src/initramfs/dev/sdc2 |
59 |
cp -a /dev/md127 /usr/src/initramfs/dev/md127 |
60 |
}}} |
61 |
|
62 |
{{{ |
63 |
cat >/usr/src/initramfs/init <<'EOS' |
64 |
#!/bin/busybox ash |
65 |
|
66 |
exec </dev/null >/dev/null 2>/dev/console |
67 |
exec 1>&2 |
68 |
|
69 |
/bin/busybox mount -n -t proc none /proc || exit 1 |
70 |
/bin/busybox mount -n -t sysfs none /sys || exit 1 |
71 |
|
72 |
/bin/mdadm -A /dev/md127 -R -a md /dev/sda2 /dev/sdc2 || exit 1 |
73 |
|
74 |
/bin/jfs_fsck -p /dev/md127 || true |
75 |
|
76 |
/bin/busybox mount -n -t jfs /dev/md127 /rootfs -o |
77 |
ro,exec,suid,dev,relatime,errors=remount-ro || exit 1 |
78 |
|
79 |
/bin/busybox umount -n /sys || exit 1 |
80 |
/bin/busybox umount -n /proc || exit 1 |
81 |
|
82 |
# /bin/busybox ash </dev/console >/dev/console 2>/dev/console || exit 1 |
83 |
|
84 |
exec /bin/busybox switch_root /rootfs /sbin/init || exit 1 |
85 |
|
86 |
exit 1 |
87 |
|
88 |
EOS |
89 |
|
90 |
chmod +x /usr/src/initramfs/init |
91 |
}}} |
92 |
|
93 |
{{{ |
94 |
( cd /usr/src/initramfs ; find . | cpio --quiet -o -H newc | gzip -9 > |
95 |
/boot/initramfs ) |
96 |
}}} |