1 |
On 25/08/2014 17:51, Peter Humphrey wrote: |
2 |
> On Monday 25 August 2014 13:35:11 Kerin Millar wrote: |
3 |
>> On 25/08/2014 12:17, Peter Humphrey wrote: |
4 |
>> |
5 |
>> <snip> |
6 |
>> |
7 |
>>> Well, it was simple. I just said "rc-update del mdraid boot" and all is |
8 |
>>> now |
9 |
>>> well. I'd better revisit the docs to see if they still give the same |
10 |
>>> advice. |
11 |
>> |
12 |
>> Very interesting indeed. |
13 |
> |
14 |
> You wrote this e-mail after the other two, so I'll stick to this route, |
15 |
> leaving the other idea for later if needed. |
16 |
> |
17 |
>> I now wonder if this is a race condition between the init script running |
18 |
>> `mdadm -As` and the fact that the mdadm package installs udev rules that |
19 |
>> allow for automatic incremental assembly? |
20 |
> |
21 |
> Isn't it just that, with the kernel auto-assembly of the root partition, and |
22 |
> udev rules having assembled the rest, all the work's been done by the time the |
23 |
> mdraid init script is called? I had wondered about the time that udev startup |
24 |
> takes; assembling the raids would account for it. |
25 |
|
26 |
Yes, it's a possibility and would constitute a race condition - even |
27 |
though it might ultimately be a harmless one. As touched upon in the |
28 |
preceding post, I'd really like to know why mdadm sees fit to return a |
29 |
non-zero exit code given that the arrays are actually assembled |
30 |
successfully. |
31 |
|
32 |
After all, even if the arrays are assembled at the point that mdadm is |
33 |
executed by the mdraid init script, partially or fully, it surely ought |
34 |
not to matter. As long as the arrays are fully assembled by the time |
35 |
mdadm exits, it should return 0 to signify success. Nothing else makes |
36 |
sense, in my opinion. It's absurd that the mdraid script is drawn into |
37 |
printing a blank error message where nothing has gone wrong. |
38 |
|
39 |
Further, the mdadm ebuild still prints elog messages stating that mdraid |
40 |
is a requirement for the boot runlevel but, with udev rules, I don't see |
41 |
how that can be true. With udev being event-driven and calling mdadm |
42 |
upon the introduction of a new device, the array should be up and |
43 |
running as of the very moment that all the disks are seen, no matter |
44 |
whether the mdraid init script is executed or not. |
45 |
|
46 |
>> Refer to /lib/udev/rules.d/64-md-raid.rules and you'll see that it calls |
47 |
>> `mdadm --incremental` for newly added devices. |
48 |
> |
49 |
> # ls -l /lib/udev/rules.d | grep raid |
50 |
> -rw-r--r-- 1 root root 2.1K Aug 23 10:34 63-md-raid-arrays.rules |
51 |
> -rw-r--r-- 1 root root 1.4K Aug 23 10:34 64-md-raid-assembly.rules |
52 |
> |
53 |
>> With that in mind, here's something else for you to try. Doing this will |
54 |
>> render these udev rules null and void: |
55 |
>> |
56 |
>> # touch /etc/udev/rules.d/64-md-raid.rules |
57 |
> |
58 |
> I did that, but I think I need instead to |
59 |
> # touch /etc/udev/rules.d/63-md-raid-arrays.rules |
60 |
> # touch /etc/udev/rules.d/64-md-raid-assembly.rules |
61 |
|
62 |
Ah, yes. Looks like the rules have changed in >=mdadm-3.3. I'm still |
63 |
using mdadm-3.2.6-r1. |
64 |
|
65 |
> |
66 |
> I'll try it now... |
67 |
> |
68 |
>> Thereafter, the mdraid script will be the only agent trying to assemble |
69 |
>> the 1.x metadata arrays so make sure that it is re-enabled. |
70 |
> |
71 |
> Right. Here's the position: |
72 |
> 1. I've left /etc/init.d/mdraid out of all run levels. I have nothing but |
73 |
> comments in mdadm.conf, but then it's not likely to be read anyway if the |
74 |
> init script isn't running. |
75 |
> 2. I have empty /etc/udev rules files as above. |
76 |
> 3. I have kernel auto-assembly of raid enabled. |
77 |
> 4. I don't use an init ram disk. |
78 |
> 5. The root partition is on /dev/md5 (0.99 metadata) |
79 |
> 6. All other partitions except /boot are under /dev/vg7 which is built on |
80 |
> top of /dev/md7 (1.x metadata). |
81 |
> 7. The system boots normally. |
82 |
|
83 |
I must confess that this boggles my mind. Under these circumstances, I |
84 |
cannot fathom how - or when - the 1.x arrays are being assembled. |
85 |
Something has to be executing mdadm at some point. |
86 |
|
87 |
> |
88 |
>> I'm not actually sure that there is any point in calling mdadm -As where |
89 |
>> the udev rules are present. I would expect it to be one approach or the |
90 |
>> other, but not both at the same time. |
91 |
> |
92 |
> That makes sense to me too. Do I even need sys-fs/mdadm installed? Maybe I'll |
93 |
> try removing it. I have a little rescue system in the same box, so it'd be |
94 |
> easy to put it back if necessary. |
95 |
|
96 |
Yes, you need mdadm because 1.x metadata arrays must be assembled in |
97 |
userspace. In Gentoo, there are three contexts I know of in which this |
98 |
may occur:- |
99 |
|
100 |
1) Within an initramfs |
101 |
2) As a result of the udev rules |
102 |
3) As a result of the mdraid script |
103 |
|
104 |
> |
105 |
>> Incidentally, the udev rules were a source of controversy in the |
106 |
>> following bug. Not everyone appreciates that they are installed by default. |
107 |
>> |
108 |
>> https://bugs.gentoo.org/show_bug.cgi?id=401707 |
109 |
> |
110 |
> I'll have a look at that - thanks. |
111 |
> |
112 |
|
113 |
--Kerin |