mdadm - error 524 when assembling array / configuration reset after reboot

It's my first question here, so hello everyone!

I have a peculiar problem with my company webserver. I was running it happily on Raspberry Pi 4 for quite some time now. For storage I used two 500GB SSD drives connected through USB3, configured as mirror array. We developed an in-company web application providing aerial photos, so large storage was in demand. 500GB was good for a while, and I've failed to react in time. Before upgrading the server to regular hardware with proper interfaces, I've decided to change the array to stripe gaining additional 500GB. I've backed up my data, purged the drives, and tried to create a new array.

mdadm --create --verbose --chunk=32 /dev/md0 --level=stripe --raid-devices=2 /dev/sda1 /dev/sdb1

That's what i get:

mdadm: RUN_ARRAY failed: Unknown error 524

After some research, including reading this thread, I've tracked the problem to default_layout configuration. After running:

echo 1 > /sys/module/raid0/parameters/default_layout

Array assembles happily, runs, mounts, works and so on:

md0 : active raid0 sdb1[1] sda1[0]
999948608 blocks super 1.2 32k chunks

unused devices: <none>

After that I update the and configuration and initramfs. Last line of my mdadm.conf:

ARRAY /dev/md0 metadata=1.2 name=###servername###:0 UUID=b1d09cdf:3399e1b3:ce7eaf05:9810ea3e

Unfortunately, after reboot everything goes away:

md0 : inactive sdb1[1] sda1[0]
999948608 blocks super 1.2

unused devices: <none>

What I've noticed, is that the default_layout always reads 0 after restart, no matter what. And when it reads 0, stripe array will always fail to assemble. So to my question, is there any way to circumvent this problem, or prevent default_layout config to reset to 0 after restart?

Additional info: - Distro: Raspbian 10 Buster lite - Kernel: 4.19.97-v7l+ - mdadm: v4.1 - 2018-10-01 - raid0 and md modules loaded

Thank you!

PS. I've tried to run this array on second RPi4 with clean Buster installation, and I didn't encounter any problems whatsoever. Interestingly the default_layout config is not present at all in the raid0 module. Second RPi kernel is 4.19.75-v7l+, mdadm v4.1 - 2018-10-01.

PS2. I'm using 32k chunks, because I'm storing millions of small files.


Solution 1:

Edit /etc/default/grub to hold GRUB_CMDLINE_LINUX_DEFAULT="raid0.default_layout=2" (or 1 as the case may be, depending on your kernel) then run update-grub or similar to save your grub configuration on disk.

Value to use:

  1. pre 3.14 kernel
  2. post 3.14 kernel

Info taken from: https://blog.icod.de/2019/10/10/caution-kernel-5-3-4-and-raid0-default_layout/