We currentl have a problem, namely that we currently need MDADM="yes" in genkernel.conf to get any implementation of mdadm into the genkernel, right? However that option willgive two problems: 1. Currently there is no check if /etc/mdadm.conf even exists before trying to copy it, which breaks "rm /etc/mdadm.conf && genkernel ramdisk --mdadm" 2. sys-fs/mdadm installs a /etc/mdadm.conf only containing comments. This leads to the ramdisk finding a /etc/mdadm.conf, which makes it skip autodetection, and since then "mdadm --assebmle --scan" runs against an empty mdadm.conf no arrays are being enabled. The second one breaks for example running "domdadm" on livecds and such that needs autodetecting. The first one broke an old workaround for said problem (and genkernel --mdadm really should not need any mdadm merged onto the system). So how should we fix this? There are things in mdadm.conf that people may want to have even if they want the ramdisk to auto-detect arrays (i.e. DEVICE,HOMEHOST,AUTO). However for the ramdisk it is essential that mdadm.conf contains ARRAY, so I propose that we in the ramdisk check if the mdadm.conf contains any non-commented ARRAY lines. If we cannot find it we run the "mdadm --examine --scan >> /etc/mdadm.conf" as we do today to add those lines. How does that sound? As for the first problem, I think about introducing a MDADM_CONFIG to genkernel.conf, which could be set to three values: empty (look for /etc/mdadm.conf and use that), string (look for file, and use as mdadm.conf in ramdisk), and none (do not copy mdadm.conf to ramdisk) and in the same time build in checks to see if the file exists before trying to copy it.
Created attachment 262415 [details, diff] 0001-Look-for-sanity-in-mdadm.conf.patch Make sure that mdadm.conf conatins any arrays ro activate
Created attachment 262417 [details, diff] 0002-Introducing-MDADM_CONFIG.patch Introduce MDADM_CONFIG if you want another mdadm.conf in your ramdisk then on your system
Comment on attachment 262415 [details, diff] 0001-Look-for-sanity-in-mdadm.conf.patch Ok, this needs rework as "mdadm --assemble --scan" nowdays both autodetects and assembles drives, so the whole "--examine --scan" is unnecessary
Comment on attachment 262417 [details, diff] 0002-Introducing-MDADM_CONFIG.patch I am going to rework this, so that we use "none" as default, and so the autodetection as default. This way, the MDADM_CONFIG becomes something for more advanced users, who may have alterations for /etc/mdadm.conf
Forgot to write that currently there is a problem in "mdadm --assemble --scan" if there are ARRAYs defined in /etc/mdadm.conf, namely devnodes for partitions are not created. Currently if I have ONE fakeraid (for some reason mdadm creates the nodes at least for my booting raid when I have two, could be the assembling order) and have the ARRAys defined, then mdadm will create /dev/md126, but not /dev/md126p1. If you however let "mdadm --assemble --scan" do the detection, then the partitions will be created too. I have yet to look into the mdadm sources, but I think it is related to some syscall not being done properly, as the partitions are listed in /proc/partitions and anything like "mdadm -E /dev/126" or "vgscan" and the devnodes are being created in my devtmpfs.
(In reply to comment #0) > 1. Currently there is no check if /etc/mdadm.conf even exists before trying to > copy it, which breaks "rm /etc/mdadm.conf && genkernel ramdisk --mdadm" Okay, that's a bug. > 2. sys-fs/mdadm installs a /etc/mdadm.conf only containing comments. This leads > to the ramdisk finding a /etc/mdadm.conf, which makes it skip autodetection, > and since then "mdadm --assebmle --scan" runs against an empty mdadm.conf no > arrays are being enabled. I see, that's bad. > However for the ramdisk it is essential that mdadm.conf contains ARRAY, so I > propose that we in the ramdisk check if the mdadm.conf contains any > non-commented ARRAY lines. If we cannot find it we run the "mdadm --examine > --scan >> /etc/mdadm.conf" as we do today to add those lines. > How does that sound? Sounds good to me, unless you object to this approach yourself by now. Not sure if I got all of the details. (In reply to comment #5) > Currently if I have ONE fakeraid (for some reason mdadm creates the nodes at > least for my booting raid when I have two, could be the assembling order) and > have the ARRAys defined, then mdadm will create /dev/md126, but not > /dev/md126p1. By chance, could this post-3.1.4 commit be related in any way? http://neil.brown.name/git?p=mdadm;a=commitdiff;h=f58dd437412348b77bc09b79c656cf3472e9913d
(In reply to comment #6) > (In reply to comment #0) > > However for the ramdisk it is essential that mdadm.conf contains ARRAY, so I > > propose that we in the ramdisk check if the mdadm.conf contains any > > non-commented ARRAY lines. If we cannot find it we run the "mdadm --examine > > --scan >> /etc/mdadm.conf" as we do today to add those lines. > > How does that sound? > > Sounds good to me, unless you object to this approach yourself by now. Not > sure if I got all of the details. > > Well, I was a bit confusing. But the "--emanie --scan" part will go totally. There is no need to add ARRAY to mdadm.conf, as if they are not defined already "mdadm --assemble --scan" will scan entries in /proc/partitons for disks with RAID-markings. > (In reply to comment #5) > > Currently if I have ONE fakeraid (for some reason mdadm creates the nodes at > > least for my booting raid when I have two, could be the assembling order) and > > have the ARRAys defined, then mdadm will create /dev/md126, but not > > /dev/md126p1. > > By chance, could this post-3.1.4 commit be related in any way? > http://neil.brown.name/git?p=mdadm;a=commitdiff;h=f58dd437412348b77bc09b79c656cf3472e9913d > I do not know, that git seems currently down. Will return when I have an answer. But with the logic I have thoughts about using, that bug will only be exposed if a user declares a mdadm.conf to be copied to the ramdisk containing a partitioned RAID.
Created attachment 263599 [details, diff] 0001-Introducing-MDADM_CONFIG.patch Make mdadm.conf costumizable, also fixes the mentioned regression
Created attachment 263601 [details, diff] 0002-Do-not-mess-with-MDADMs-auto-detect.patch Remove messing with autodetection, as this breaks fakeraids
Created attachment 263669 [details, diff] docs: Improve docs on MDADM_CONFIG Thanks for these patches. Very nice. Pushed to experimental. Here's a patch I applied on top of yours. Please make sure to check "patch" when uploading attachments.
(In reply to comment #10) > Created an attachment (id=263669) [details] > docs: Improve docs on MDADM_CONFIG > > Thanks for these patches. Very nice. Pushed to experimental. > > Here's a patch I applied on top of yours. > Thanks, feels much clearer. > Please make sure to check "patch" when uploading attachments. > Heh, yeah. I usually use pybugz, and forgets about the flag...:/