4

I'm trying to create 4 RAID 0 disk arrays on my system running Centos 7.5 and have the RAIDs automount after a reboot. For some reason, only one of the RAIDs /dev/md0 is persistent between boots. The remaining three RAIDs (md1,md2,md3) all disappear after a reboot.

I build the RAIDs using:

$ sudo mdadm --create --chunk 4096 --verbose /dev/md0 --level=stripe \ --raid-devices=2 /dev/nvme0n1 /dev/nvme1n1 $ sudo mdadm --create --chunk 4096 --verbose /dev/md1 --level=stripe \ --raid-devices=2 /dev/nvme2n1 /dev/nvme3n1 $ sudo mdadm --create --chunk 4096 --verbose /dev/md2 --level=stripe \ --raid-devices=2 /dev/nvme4n1 /dev/nvme5n1 $ sudo mdadm --create --chunk 4096 --verbose /dev/md3 --level=stripe \ --raid-devices=2 /dev/nvme6n1 /dev/nvme7n1 

Then I update the /etc/mdadm.conf file using:

$ mdadm --detail --scan >> /etc/mdadm.conf 

Finally after mounting the drives to their appropriate directory and adding them to /etc/fstab I rebuilt the initramfs image using dracut:

$ sudo dracut --force --mdadmconf 

After running dracut, I reboot the system and /dev/md0 is there but the other RAIDs are not, so I did some investigating and it seems like /etc/mdadm.conf is not being included in the initramfs, so I repeated all of the previous steps, except for the dracut command I manually added what seemed to be missing using:

$ sudo dracut --force --include /etc/mdadm.conf /etc/mdadm.conf \ --add="mdraid" --mdadmconf` 

After running the command, I see that /etc/mdadm.conf and /usr/sbin/mdadm are included in the initramfs using:

$ sudo lsinitrd /boot/initramfs-$(uname -r).img 

What am I missing?

Edit 1 I've added mdadm --assemble --scan to /etc/rc.local and tried running it from the command line once the system has booted, but md1, md2, and md3 still are not found. As before, md0 is found at boot.

I have a separate OS disk, so I am not booting from md0

3
  • Are the partitions marked linux raid? (type fd) Commented Aug 8, 2018 at 9:39
  • Looking at this it would seem to be the case that you're suppose to bring up the rest yourself - superuser.com/questions/801826/…. The A'er you received is basically telling you this, but not telling you how. You could put mdadm --assemble --scan in rc.local to see if it forces them to come up. I'd suspect you could put this into systemd as well. Commented Aug 8, 2018 at 11:04
  • See this thread - centos.org/forums/viewtopic.php?t=54901. Commented Aug 8, 2018 at 11:21

1 Answer 1

1

The initrd only creates the RAID array needed for root and swap. Run this from the main system (after initrd changes to the real root)

$ sudo mdadm --assemble --scan 
1
  • Whoever downvoted, please give at least a reason. Regarding sudo, I didn't mean to run it from the command line as an unprivileged user, but from a script that runs as root. Commented Aug 8, 2018 at 6:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.