Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: How does grub assemble a RAID1 for / ??
Date: Sun, 04 Apr 2010 23:03:31
Message-Id: j2g5bdc1c8b1004041516hdf7b1768n68a67c1fb210a6e7@mail.gmail.com
In Reply to: [gentoo-user] Re: How does grub assemble a RAID1 for / ?? by Kerin Millar
1 On Sun, Apr 4, 2010 at 1:06 PM, Kerin Millar <kerframil@×××××.com> wrote:
2 > On 04/04/2010 20:52, Mark Knecht wrote:
3 >>
4 >> So this suggests that because I did the install from a running Gentoo
5 >> chroot that the mknod commands didn't stick? Somehow they were part
6 >> of, or because part of, the host Gentoo non-RAID install? Interesting.
7 >
8 > I don't know what the handbook says these days, but I understand that it's
9 > lately taken to recommending a bind mount of /dev. If that's the case, then
10 > none of the static device nodes that are contained with the /dev directory
11 > within the stage3 tarball will actually make it on to the root filesystem
12 > because, at the time of unpacking, they will be redirected to the (volatile)
13 > tmpfs mount at /dev with respect to the livecd environment.
14 >
15 > From the point of view of the problem you're having, it may not even matter
16 > but it's one thing to try anyway.
17 >
18 > It's interesting that the component disks are available. In principle,
19 > there's no reason why the array should not be assembled. Here's an example
20 > of how it looks during the boot process on one of my systems:
21 >
22 >  Command line: root=/dev/md2
23 >  Kernel command line: root=/dev/md2 quiet
24 >  ata1: SATA max UDMA/133 cmd 0xcc30 ctl 0xcc28 bmdma 0xcc40 irq 23
25 >  ata2: SATA max UDMA/133 cmd 0xcc38 ctl 0xcc2c bmdma 0xcc48 irq 23
26 <SNIP>
27 >
28 > You might consider disabling the framebuffer temporarily, as it may impact
29 > upon your ability to see what's going on early during the boot process.
30 >
31 > Cheers,
32 >
33 > --Kerin
34
35 Hi Kerin,
36 First, thanks for sticking with me on this. I really appreciate it.
37 Second, I apologize for the length of the reply but it's still not
38 working and I wanted to try and clearly show the steps I've taken.
39 Maybe you or someone else will see the step I'm missing.
40
41 OK, more and more it's looking to me like on the RAID I'm just not
42 getting the /devmdX special file that has to be there to
43 mount/bind/whatever the hardware to. What creates it, other than
44 mknod? Can I do it by hand some other way? Read on...
45
46 1) Booted non-RAID and look in /dev for md*. md0 is there. I mount the
47 RAID and look in the directory /mnt/gentoo/dev/ for anything named
48 md*. There's nothing.
49
50 2) Booting with the Live CD I modprobe raid1, assemble the RAID, and
51 then do the recommended chroot:
52
53 livecd usr # cd /
54 livecd / # mount -t proc proc /mnt/gentoo/proc
55 livecd / # mount -o bind /dev /mnt/gentoo/dev
56 livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/
57 livecd / # chroot /mnt/gentoo /bin/bash
58 livecd / # env-update && source /etc/profile
59
60 3) I look in /dev and still no md*. (There shouldn't be)
61
62 4) Because I used md3 to get into the RAID from the Live CD I create
63 some new devices, but specifically don't do md3:
64
65 livecd / # mknod /dev/md0 b 9 0
66 livecd / # mknod /dev/md1 b 9 1
67 livecd / # mknod /dev/md2 b 9 2
68 livecd / # mknod /dev/md4 b 9 4
69 livecd / # mknod /dev/md5 b 9 5
70
71 5) ls the directory and I see the ones I created plus md3 bound from
72 the chroot above:
73
74 livecd / # ls /dev/md*
75 /dev/md0 /dev/md1 /dev/md2 /dev/md3 /dev/md4 /dev/md5
76
77 /dev/md:
78 3
79
80 6) I exit the chroot and look again at what's now in the Live CD /dev.
81 As expected I still see all 6.
82
83 livecd / # exit
84 exit
85 livecd ~ #
86 ls /dev/md*
87 /dev/md0 /dev/md1 /dev/md2 /dev/md3 /dev/md4 /dev/md5
88
89 /dev/md:
90 3
91 livecd ~ # df
92 Filesystem 1K-blocks Used Available Use% Mounted on
93 tmpfs 3052532 29600 3022932 1% /
94 /dev/sr0 117392 117392 0 100% /mnt/cdrom
95 /dev/loop0 87424 87424 0 100% /mnt/livecd
96 udev 10240 216 10024 3% /dev
97 tmpfs 3052532 6152 3046380 1%
98 /mnt/livecd/lib64/firmware
99 tmpfs 3052532 0 3052532 0% /mnt/livecd/usr/portage
100 /dev/md3 30969528 2254188 27142180 8% /mnt/gentoo
101 livecd ~ #
102
103
104 7) Try booting RAID a couple of times with different command line
105 options. It still fails the same way.
106
107 8) Boot back to non-RAID and mount the RAID, this time as md0 just to
108 be different. I look in /dev and see only md0, as expected:
109
110 keeper ~ # df
111 Filesystem 1K-blocks Used Available Use% Mounted on
112 /dev/sda3 30969600 7244840 22151596 25% /
113 udev 10240 228 10012 3% /dev
114 shm 3053512 0 3053512 0% /dev/shm
115 /dev/md0 30969528 2254188 27142180 8% /mnt/gentoo
116 keeper ~ # ls /dev/md*
117 /dev/md0
118
119 /dev/md:
120 0
121 keeper ~ #
122
123 9) I look in /mnt/gentoo/dev to see if ANY md special files are there.
124 There are none:
125
126 keeper ~ # ls -al /mnt/gentoo/dev/md*
127 ls: cannot access /mnt/gentoo/dev/md*: No such file or directory
128 keeper ~ #
129
130
131 All the other stuff is there, but not the special files I created
132 while in the chroot.
133
134 So, to me, this comes down to something like when I'm booting /dev/md0
135 or md3 isn't available so the kernel cannot mount the RAID anywhere.
136 What creates the special file, at least by hand, is mknod, and for
137 some reason I'm unable to make that work for me. Either there's
138 something weird about doing this on RAID, or there's something stupid
139 that I'm still doing. (I vote for the latter although I've been doing
140 it for days so I probably cannot even see it anymore.) I guess I would
141 hope that some piece of software is supposed to make these special
142 files on the fly when booting if they don't exist. Maybe that's the
143 purpose of appending md=0,/dev/sdb3,/dev/sdc3 but even that's not
144 working for me.
145
146 Maybe that points to something in kernel config that turns that on? I
147 don't know.
148
149 Note that in the Gentoo RAID install guide that I'm following the only
150 mknod step is pre-chroot so nothing in the final RAID design ever does
151 that by hand. If that guide actually results in a working system
152
153 http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml
154
155 I've tried all the boot options shown at the end.
156
157 I don't know what to try next.
158
159 Cheers,
160 Mark
161
162 RAID fstab:
163
164 /dev/sda1 /boot ext2 noauto,noatime 1 2
165 /dev/md0 / ext3 noatime 0 1
166 /dev/sda2 none swap sw 0 0
167 /dev/sdb2 none swap sw 0 0
168 /dev/sdc2 none swap sw 0 0
169 /dev/cdrom /mnt/cdrom auto noauto,ro 0 0
170
171 grub.conf:
172
173 default 0
174 timeout 30
175 splashimage=(hd0,0)/boot/grub/splash.xpm.gz
176
177 title /dev/sda1 Gentoo Linux 2.6.33-gentoo
178 root (hd0,0)
179 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo root=/dev/sda3
180
181 title /dev/sda1 Gentoo Linux 2.6.33-gentoo-RAID using md0
182 root (hd0,0)
183 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo-RAID root=/dev/md0
184
185 title /dev/sda1 Gentoo Linux 2.6.33-gentoo-RAID using md3
186 root (hd0,0)
187 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo-RAID root=/dev/md3
188
189 title /dev/sda1 Gentoo Linux 2.6.33-gentoo-RAID explicit md0=...
190 root (hd0,0)
191 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo-RAID root=/dev/md0
192 md=0,/dev/sdb3,/dev/sdc3
193
194 title /dev/sda1 Gentoo Linux 2.6.33-gentoo-RAID explicit md3=...
195 root (hd0,0)
196 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo-RAID root=/dev/md3
197 md=3,/dev/sdb3,/dev/sdc3
198
199 title /dev/sda1 Gentoo Linux 2.6.33-gentoo-RAID sdb3 only
200 root (hd0,0)
201 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo-RAID root=/dev/sdb3
202
203 title /dev/sda1 Gentoo Linux 2.6.33-gentoo-RAID sdc3 only
204 root (hd0,0)
205 kernel (hd0,0)/boot/bzImage-2.6.33-gentoo-RAID root=/dev/sdc3

Replies

Subject Author
[gentoo-user] Re: How does grub assemble a RAID1 for / ?? Kerin Millar <kerframil@×××××.com>