Hi fellow selfhoster,
Im a bit lost on the following scenario and im unable to find any documentation about it so i was hoping some smart people here could point me in the right direction.
I have a linux software raid 6 that contains a LUKS partition with ext4 in it. I would like to automount the ext4 when im rebooting. The root partition is also using LUKS and i have successfully setup the decryption for this parition but im uncertain on how to do this with this raid setup since im not sure where in the boot process linux recognizes my raid and when the decryption happens.
This is what i have:
[root@nfs-rocky-1 ~]# cat /etc/mdadm.conf
ARRAY /dev/md/server1:0 metadata=1.2 UUID=3e198408:2236ed3d:1dc13a8e:e5f91e52
On a reboot the raid does get automaticly recognizes but i still have to do cryptsetup luksOpen /dev/md0 raid & mount /dev/mapper/raid /mnt/data.
What would be the best way to do this? Im a bit scared of doing this im not certain of since i don’t want my machine to be stuck at a boot.
Just a like to an article that dicusses something like this already would help me greatly.


Usually raid and decryption happen in the initram. This is because these are too complex to sit purely in the kernel, requiring userspace tools like cryptsetup, but you want to be able to boot off of them so they have to be handled before the disk is mounted.
Usually that initram is dracut. Why dracut only partially completes the process here, likely figuring out the raid but not decryption, is anyones guess. In my experience dracut is quite hard to debug and configure.
The simplest approach is probably to just eat it and write a startup service that does it. Basically a startup command. No need to worry about timing, as when the initram finishes the raid should already be up.
There might be a prebuilt systemd service for it too iirc…
If you really wanns go for it, there are other initram systems like ugrd, which are easier to configure and might figure your setup out properly. But you’ll probably have to manually install and update them. That would definitely be a very involved approach.
There are some guesses I made here on your boot timeline. If you show your dmesg I can confirm if the raid really comes up at initramfs time. But it should be s solid bet.