I have 2 disks, each 1TB in size, and both of them are a member of an MD RAID-1 array, as created by this command:
mdadm --create /dev/md0 /dev/sda /dev/sde --level=1 --metadata=1.0 The argument --metadata=1.0 instructs the kernel to use a specific MD RAID header that resides at the end of the physical disks.
The reason I made this decision is because disks in this array must be bootable by a UEFI that does not understand MD RAIDs; so from the view of UEFI, it can pick any member disk and boot from it just fine, as it will find GPT partition tables at the beginning of the disk just like any normal disk that is not part of a RAID setup.
The kernel, along the initramfs, are placed in the UEFI partition. UEFI loads the kernel from any member disk that the UEFI system chooses, without UEFI knowing anything about RAID. This already works, as all member disks are identical (thanks to RAID 1 mirroring over them).
Once the MD RAID-capable kernel loads, it reads the RAID metadata (at the end of the disks), and automatically assembles them into the logical mapper device file /dev/md0. This sort of works.
Currently, I have two problems:
Problem 1: The kernel detects the existence of the MD RAID array, which proves that the kernel is reading MD RAID headers.
But the problem is that it only shows up 1 member disk, and doesn't show the other. Which disk is chosen shuffles randomly across reboots, but only 1 is shown.
Logically, this would mean that the kernel is somehow not reading the metadata header of one of the other disks, hence not knowing of their existence. Even though, say,
mdadm --examine /dev/sdashows that it is indeed a RAID member (suppose that/dev/sdawas the unlucky one at this reboot).Trying to add the unlucky disk to the array, causes
mdadmto say says that the disk is busy.Additionally, the unlucky disk does not get any mirroring to it. For example, if I edit some files in a reboot with
/dev/sdeshowing, then if I reboot again so that the other,/dev/sda, is shown, then I would not see any of the changes that I made during the previous reboot when/dev/sdewas shown. This shows that there is no mirroring.Problem 2:
fdisk /dev/md0says that the backup GPT table is corrupt. The backup table exists at the end of the disks in the case of GPT.I don't know the cause of this. Is
fdiskpeeking into the end of the physical disks/dev/sdaand/dev/sde? How did it even know of them (if it did)? After all, I just gave it a logical mapper device/dev/md0that should abstract the physical member disks. I would imagine that/dev/md0is also smaller in size as it should subtract the metadata that MD RAID puts in the physical disks.
Question: What is going on? How to resolve both of the problems?
Background: I'm on Gentoo Linux latest stable version, a fresh installation this week, using systemd and systemd-boot (formerly known as the gummiboot).