Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mdadm device list format with Genkernel initramfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Vieri
l33t
l33t


Joined: 18 Dec 2005
Posts: 632

PostPosted: Mon Dec 30, 2019 3:22 pm    Post subject: mdadm device list format with Genkernel initramfs Reply with quote

Hi,

I would like to fully understand the last comment of bug https://bugs.gentoo.org/609406.

Why is controlling device name in /dev top level directory not supported?
Is it something that cannot and will not be fixed for a policy reason, or is it technical?

In any case, when I'm installing my Gentoo systems I do not create the mdadm.conf file manually. Instead, I use the command "mdadm --detail --scan", and dump it to mdadm.conf. I then call genkernel by specifying this newly created conf file.
The problem is that "mdadm" dumps devices in the /dev/mdNUMBER format, not /dev/md/NUMBER.

Do I need to hack my way out if this by listing the devices within /dev/md/* and creating my own mdadm.conf, or is there a simpler way?

Thanks
Back to top
View user's profile Send private message
Whissi
Developer
Developer


Joined: 12 Jan 2011
Posts: 78

PostPosted: Tue Dec 31, 2019 5:45 pm    Post subject: Reply with quote

Controlling top level directory is nearly impossible because mdev is in charge and it's really not worth it to waste time on this.

It maybe interesting to know why you care that mich about names. You are probably doing things wrong or there are better way to do things... so please share your reasons.

But if you care that much, try to disable auto-assembling RAID at boot in kernel and you maybe need to change partition types as well. This should prevent the creation of /dev/mdX devices. Now you can create your /dev/mdX on you own using /etc/mdadm.conf.
_________________
Regards,
Whissi
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15334

PostPosted: Tue Dec 31, 2019 11:53 pm    Post subject: Reply with quote

OP said that using mdadm to generate the configuration file insists on generating these "bad" names in the resulting file, requiring the user to fix them afterward to refer to supported names. I suspect if it could be made to generate names based on the supported scheme, then OP would not care about controlling the top level names.
Back to top
View user's profile Send private message
Vieri
l33t
l33t


Joined: 18 Dec 2005
Posts: 632

PostPosted: Thu Jan 02, 2020 12:03 pm    Post subject: Reply with quote

Thanks, Hu, that's what I meant.

The problem with not passing a custom mdadm.conf and leaving the label assignment to the boot process is that I end up with arbitrary device numbers (127, 128, whatever). I prefer to have consistent numbers throughout my server installations, eg. /dev/md1, /dev/md2, /dev/md3, /dev/md4, /dev/md5, etc., so that I know that, say, md5 is a RAID1 of root on any server, etc.

So, I need to create a valid mdadm.conf file, and to do so I'd rather do it automatically by simply running something like mdadm --detail --scan from the live installation system instead of writing it by hand.

I then pass the mdadm.conf to genkernel.
Back to top
View user's profile Send private message
Whissi
Developer
Developer


Joined: 12 Jan 2011
Posts: 78

PostPosted: Thu Jan 02, 2020 1:15 pm    Post subject: Reply with quote

Use UUIDs! If you cannot and need to stick to some kind of labels, use /dev/md/naming. It will work out of the box if you pay attention during creation. I.e. when you create your MD devices, ensure that you will already use /dev/md/foo naming because
Code:
mdadm --detail --scan
will use whatever name was set. So if you create everything the way you want it, your mdadm.conf won't require manual adjustment afterwards.

Maybe in theory, we could skip setup_md_device if /etc/mdadm.conf is present in initramfs. However, I am not going to spend any time on this: Like said, relying on that naming schema isn't safe -- nobody should use it. And because most user will use genkernel without embedded mdadm.conf, a lot of testing would be required to make sure that this doesn't break some old setups. Also think about the users who blindly embed an mdadm.conf which is empty or not valid. Sure, they are doing something wrong but I will not be the guy telling them when they find out that new genkernel was unable to boot their system which booted past 10 years... just because to support another, questionable, old setup although there are better alternatives. Sorry.

Another workaround: Put LVM on top so you don't have md* in
Code:
root=
kernel command-line argument in which case setup_md_device won't do anything for you.

That said, maybe we could introduce a
Code:
gk.mdadm.skip-autorun
kernel command-line argument which will skip setup_md_device function if set. Would that help you? Remember, you still have to adjust the way how you create your RAID or adjust mdadm.conf afterwards..
_________________
Regards,
Whissi
Back to top
View user's profile Send private message
Vieri
l33t
l33t


Joined: 18 Dec 2005
Posts: 632

PostPosted: Thu Jan 02, 2020 1:59 pm    Post subject: Reply with quote

So, when I create the MD as in https://wiki.gentoo.org/wiki/Complete_Handbook/Software_RAID, I should not use the format /dev/mdx as suggested but /dev/md/x instead, right?

I'll give it a try, and see what mdadm outputs.
If it looks as expected then I'll also try not to pass mdadm.conf to genkernel.

Doesn't passing mdadm.conf to genkernel (ie. initramfs) speed up the boot process as there's no need to autodetect the raid devices?

Thanks
Back to top
View user's profile Send private message
Whissi
Developer
Developer


Joined: 12 Jan 2011
Posts: 78

PostPosted: Thu Jan 02, 2020 3:05 pm    Post subject: Reply with quote

Vieri wrote:
So, when I create the MD as in https://wiki.gentoo.org/wiki/Complete_Handbook/Software_RAID, I should not use the format /dev/mdx as suggested but /dev/md/x instead, right?
Yes, don't use that format if you rely on MD dev name.

Vieri wrote:
I'll give it a try, and see what mdadm outputs.
If it looks as expected then I'll also try not to pass mdadm.conf to genkernel.
No, that's not going to work. You still have to use mdadm.conf in case you want to control naming. My previous answer addressed
Vieri wrote:
Instead, I use the command "mdadm --detail --scan", and dump it to mdadm.conf.
I.e. my understanding was that you complaint you would be unable to use
Code:
mdadm --detail --scan > /etc/mdadm.conf
out of the box because it would create mdadm.conf with a different naming schema. What I wanted to say: The mdadm command above will dump current active mdraid configuration. So if you end up with a naming schema in /etc/mdadm.conf after running the command above, that's because you dumped such an active configuration. Now it should be clear how to "fix" that: Make sure that current active mdraid configuration rmatches the one you want and in that case, you can just "dump" that configuration without the need to adjust /etc/mdadm.conf afterwards.

Vieri wrote:
Doesn't passing mdadm.conf to genkernel (ie. initramfs) speed up the boot process as there's no need to autodetect the raid devices?
Not really. A modern mdadm.conf will contain something like
Code:
ARRAY /dev/md/boot metadata=1.2 name=vm-gentoo-x64:boot UUID=f2d73d74:782e76ff:421088b1:49fe7632
ARRAY /dev/md/data metadata=1.2 name=vm-gentoo-x64:data UUID=h94b684e:f0411d0e:2b2dc92c:a37b5a42
So mdadm will still have to scan all disks until it found referenced meta data by its own UUID (that's not the UUID you see in blkid for example). What's different: If you have 20 disks for example and are only using 2 of them for md raid, mdadm will stop when all arrays from mdadm.conf are loaded. Without mdadm.conf, mdadm would scan every disk for md raid.
_________________
Regards,
Whissi
Back to top
View user's profile Send private message
Vieri
l33t
l33t


Joined: 18 Dec 2005
Posts: 632

PostPosted: Fri Jan 03, 2020 10:02 am    Post subject: Reply with quote

OK, thanks a lot for the useful info.
I'll give it a try asap.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum