tl;dr:
RAID array + LVM dissapears after reboot.
Detail
I wanted to set up an encrypted raid array, based on this SO.
I set up a RAID array "bare metal" (i.e. on the disks not on the partitions). Once the array was built I didn't format it and ran pvcreate. Then I set up LVM and encryption in the usual way. (See Digital Ocean Guide on RAID, arch guide on LVM on RAID.
After setting up encryption, I ran mdadm --detail --scan | tee -a /etc/mdadm/mdadm.conf then update-initramfs -u and issued a reboot. /dev/md0 is then gone. Where did I go wrong?
Steps to debug.
There are a lot of similar questions, this is what I have tried so far based on my reading.
- Output of
mdadm --examine --scanis blank. - uncommented contents of
/etc/mdadm/mdadm.conf:HOMEHOST <system>,MAILADDR root,ARRAY /dev/md0 metadata=1.2 name=server:0 UUID=xxxxxThere are no duplicate entries as suggested in some SO answers. - Issuing
service mdadm statusyieldsLoaded: masked (Reason: Unit mdadm.service is masked.) - Issuing
cat /proc/mdstatyeildsPersonalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] \n unused devices: <none> - I tried running
dpkg-reconfigure mdadmandupdate-initramfs -uas suggested here and I did not get an option to enable "all". I tried rebooting after this, which also did not work.
As a last resort I tried mdadm --assemble --scan.
Strangely, the type is not TYPE="linux_raid_member" as I would have expected from this SO
root@server:/home/user# blkid
/dev/sda1: UUID="xx" TYPE="ext2" PARTUUID="xx-xx"
/dev/sda5: UUID="xx" TYPE="LVM2_member" PARTUUID="xx-xx"
/dev/mapper/server--vg-root: UUID="xx" TYPE="ext4"
/dev/mapper/server--vg-swap_1: UUID="xx" TYPE="swap"
/dev/sdb: PTUUID="xx" PTTYPE="gpt"
/dev/sdc: PTUUID="xx" PTTYPE="gpt"
/dev/sdd: PTUUID="xx" PTTYPE="gpt"
The array is over sd[bcd] and /dev/sda holds the root filesystem. This array drive is for data.
Steps to recreate.
For completeness and in case it is useful.
mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sddCreate arraypvcreate /dev/md0Make physical volumevgcreate data_group /dev/md0Create vol grouplvcreate -n secure data_group -L +900GCreate volumecryptsetup -v luksFormat /dev/data_group/secureSetup encryptioncryptsetup luksOpen /dev/data_group/secure cryptvaultOpen encrypted volumemkfs.ext4 /dev/mapper/cryptvaultPartitionmkdir /mnt/vaultMake mount pointmount /dev/mapper/cryptvault /mnt/vaultMountmdadm --detail --scan | tee -a /etc/mdadm/mdadm.confSave array layoutupdate-initramfs -uUpdate init with new configreboot