Restore RAID after migrating to TOS 4

I decided to update my Omnia to OS 4.0.

Prior to updating, I saved many of the configuration files and was able to restore the related services.

Now I’m trying to recreate my RAID 1 device.

The RAID used drives that are now associated w/ sdb and sdc:

# llsblk -o NAME,SIZE,MOUNTPOINT,STATE,FSTYPE,MODEL,SERIAL,UUID,LABEL
NAME           SIZE MOUNTPOINT STATE   FSTYPE            MODEL            SERIAL         UUID                                 LABEL
    sda          465.9G            running                   Transcend                                                        
    └─sda1       465.9G /srv               btrfs                                         b8182a41-cc7f-40e6-8ec1-ca670db70625 Jetdrive
    sdb            1.8T            running linux_raid_member ST32000542AS                69c415bb-716b-8e0b-b03d-721888a9cb05 turris:0
    sdc            1.8T            running linux_raid_member ST32000542AS                69c415bb-716b-8e0b-b03d-721888a9cb05 turris:0

Some recognition of RAID device:

# mdadm --examine --scan
ARRAY /dev/md/0  metadata=1.2 UUID=69c415bb:716b8e0b:b03d7218:88a9cb05 name=turris:0

Doesn’t seem to be aware of the RAID:

# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] 
unused devices: <none>

Contents of configuration file:

DEVICE partitions

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# 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 (# mdadm --examine --scan)
ARRAY /dev/md/0  metadata=1.2 UUID=69c415bb:716b8e0b:b03d7218:88a9cb05 name=turris:0

Creating the array:

# mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc
mdadm: /dev/sdb appears to contain an ext2fs file system
       size=1953514584K  mtime=Wed Dec 31 18:00:00 1969
mdadm: /dev/sdb appears to be part of a raid array:
       level=raid1 devices=2 ctime=Sun Jul 23 11:52:07 2017
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: /dev/sdc appears to contain an ext2fs file system
       size=1953514584K  mtime=Sat Jul 22 19:01:26 2017
mdadm: /dev/sdc appears to be part of a raid array:
       level=raid1 devices=2 ctime=Sun Jul 23 11:52:07 2017
mdadm: size set to 1953383488K
mdadm: automatically enabling write-intent bitmap on large array
Continue creating array? n
mdadm: create aborted.

What is the correct process to restore the RAID device?

This seemed to work:

# mdadm --assemble --force /dev/md0 /dev/sdb /dev/sdc

Appears as md0:

# lsblk -o NAME,SIZE,MOUNTPOINT,STATE,FSTYPE,MODEL,SERIAL,UUID,LABEL

NAME           SIZE MOUNTPOINT STATE   FSTYPE            MODEL            SERIAL     UUID                                 LABEL
sda          465.9G            running                   Transcend                                                        
└─sda1       465.9G /srv               btrfs                                         b8182a41-cc7f-40e6-8ec1-ca670db70625 Jetdrive
sdb            1.8T            running linux_raid_member ST32000542AS                69c415bb-716b-8e0b-b03d-721888a9cb05 turris:0
└─md0          1.8T                    btrfs                                         47039540-3842-4b2b-be2b-b8f76e88189b 
sdc            1.8T            running linux_raid_member ST32000542AS                69c415bb-716b-8e0b-b03d-721888a9cb05 turris:0
└─md0          1.8T                    btrfs                                         47039540-3842-4b2b-be2b-b8f76e88189b

Unfortunately, this configuration didn’t survive a reboot.

Thoughts?

It seems TOS4 has inherited a bug from its master OpenWRT 18.06.0

Adding kernel.randomize_va_space=0 to /etc/sysctl.conf finally solved all the troubles

Original solution I have found is here: https://forum.openwrt.org/t/raid-not-working-on-18-06-0/18498/10

Thanks for the help.