Ubuntu: Raid array missing after reboot



Question:

While I see that there are multiple other questions that seem to be about the same (or similar) issue, none of them have a difinitive answer. Hence, I ask it again.

I am following the guide here (external, Digital Ocean), specifically the "Raid 1" guide. I follow all the steps, yet when I reboot, mdadm seems to forget about the raid array created.

When recreated, it seems fine and the data on the drive seems to persist after recreation, though mdadm needs to re-sync and build the array all over again (which takes many hours). To clarify, all I need to do to get the raid drive back is to rerun the create command and remount the array.

I followed the "Save the Array Layout" section to a tee, yet this still happens. Can anyone offer guidance on how to make the array stick around?

If anyone wants to see the output of something, just ask.

/dev/sdb/ and /dev/sdc/ are the drives I am using for the array, /dev/md0 is the array.

Output of sudo blkid after reboot:

/dev/nvme0n1: PTUUID="a2ac4afb-a9fe-4c9c-aafd-ffe2e144b803" PTTYPE="gpt"  /dev/nvme0n1p1: UUID="f9b2e155-854d-4a5d-a67e-17bd15f38289" TYPE="ext4" PARTUUID="72fd637a-3f84-4c87-a1fc-6dd4d093ee1d"  /dev/sda1: LABEL="Recovery" UUID="56FEDCF2FEDCCAFF" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ba0395b4-48a6-45b1-b340-cf4bfe1d29d2"  /dev/sda2: UUID="1ADD-CEB5" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="2024cdff-4b6f-460e-827d-7443180849e6"  /dev/sda3: PARTLABEL="Microsoft reserved partition" PARTUUID="b0475376-4a4c-4388-8c13-486587f441d9"  /dev/sda4: UUID="22D0E70AD0E6E2D1" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="e4d35323-a0b8-4a47-9722-193cc6cd1197"  /dev/sdb: PTUUID="aea84627-3e11-46a5-8a09-96510cae3a1a" PTTYPE="gpt"  /dev/sdc: PTUUID="76fce25c-b721-441b-b82e-b42d2d43d24b" PTTYPE="gpt"  

Output of sudo blkid after re-creating raid array:

/dev/nvme0n1p1: UUID="f9b2e155-854d-4a5d-a67e-17bd15f38289" TYPE="ext4" PARTUUID="72fd637a-3f84-4c87-a1fc-6dd4d093ee1d"  /dev/sda1: LABEL="Recovery" UUID="56FEDCF2FEDCCAFF" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ba0395b4-48a6-45b1-b340-cf4bfe1d29d2"  /dev/sda2: UUID="1ADD-CEB5" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="2024cdff-4b6f-460e-827d-7443180849e6"  /dev/sda4: UUID="22D0E70AD0E6E2D1" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="e4d35323-a0b8-4a47-9722-193cc6cd1197"  /dev/nvme0n1: PTUUID="a2ac4afb-a9fe-4c9c-aafd-ffe2e144b803" PTTYPE="gpt"  /dev/sda3: PARTLABEL="Microsoft reserved partition" PARTUUID="b0475376-4a4c-4388-8c13-486587f441d9"  /dev/sdb: UUID="f80520f0-6304-ccc5-0ec2-bd8f6a2af079" UUID_SUB="5a38cecf-4236-db6a-d369-a53271993698" LABEL="BATTLESTAR:0" TYPE="linux_raid_member"  /dev/md0: LABEL="DataStore" UUID="c5be481b-d487-4632-8594-7b0b847f327a" TYPE="ext4"  /dev/sdc: UUID="f80520f0-6304-ccc5-0ec2-bd8f6a2af079" UUID_SUB="cd27b6f9-d6e3-1c22-8746-3f2ebb3c5eb4" LABEL="BATTLESTAR:0" TYPE="linux_raid_member"  

Contents of /etc/mdadm/mdadm.conf: (I make sure to update this on every recreate to ensure the UUID is updated)

# mdadm.conf  #  # !NB! Run update-initramfs -u after updating this file.  # !NB! This will ensure that initramfs has an uptodate copy.  #  # Please refer to mdadm.conf(5) for information about this file.  #    # by default (built-in), scan all partitions (/proc/partitions) and all  # containers for MD superblocks. alternatively, specify devices to scan, using  # wildcards if desired.  #DEVICE partitions containers    # automatically tag new arrays as belonging to the local system  HOMEHOST <system>    # instruct the monitoring daemon where to send mail alerts  MAILADDR root    # definitions of existing MD arrays    # This configuration was auto-generated on Mon, 05 Mar 2018 19:04:50 -0500 by mkconf    ARRAY /dev/md0 metadata=1.2 name=BATTLESTAR:0 UUID=f80520f0:6304ccc5:0ec2bd8f:6a2af079  


Solution:1

Allright, I figured it out, thanks to a tip from another question....

What ended up solving my problem was creating an ext4 partition on each drive, and pointing mdadm at the partitions and not the drives themselves. After that, the array was persistent after reboot.

I did not try this before this question because the other question had not marked the answer as accepted.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »