Extroot with RAID1


i want to move the roofs of my Arcadyan ARV752DPW to an external USB-Flash-Drive. I have done this before, but only with one drive. Now I want to do it with two drives in RAID1.
I have made a RAID device with mdadm and two drives. Everything works fine until the next reboot. Then the RAID device is no longer created and of course can not be mounted. How can I automatically create the RAID device on every reboot?


Maybe somebody will correct me if I'm wrong, but I think you cannot put extroot on a raid device. It's because the mdadm process starts much later than mounting the root partition (see scripts in /etc/rc.d/).

Creating raid devices at every boot is easy, see the file /etc/config/mdadm. You should put the correct uuid in the config array section. You can find it with mdadm --detail /dev/md0.

hey ticerex,

thanks for your reply.
Meanwhile, the RAID works properly. But as you say, the process starts too late.


I do it using imagebuilder and a prefixed set of a files, in my case:

make image PROFILE=iom_ix2_200 PACKAGES="block-mount kmod-fs-ext4 e2fsprogs kmod-fs-xfs xfs-fsck kmod-md-mod kmod-md-raid1 mdadm" FILES=../files/

in files directory I put:

config global
        option anon_swap '0'
        option anon_mount '0'
        option auto_swap '1'
        option auto_mount '1'
        option delay_root '3'
        option check_fs '0'

config mount 'overlay'
        option uuid 'c75144d4-ab33-4805-9243-842d8682e0fb'
        option target '/overlay'

config mount 'rwm'
        option device '/dev/ubi0_1'
        option target '/rwm'

config mount 'r1data'
        option uuid '0d49f8c5-6749-4769-8bdf-d2653ea52ebd'
        option target '/mnt/r1data'


config mdadm
        option email root

config array
        option uuid 0612c9c6:40e20d3e:f66e0e0c:926a28aa
        option device /dev/md0

config array
        option uuid 2cac191a:1556d637:1bf789fd:56d8de2a
        option device /dev/md1


  echo "myload_raid!"
  modprobe raid1
  mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main myload_raid

latter is the important thing, it create md0 raid before the init process mount the system root

For the rest you need determine uuid after create the raid:

mdadm --detail /dev/md0

md1 is only my data partition

a little note, after sysupgrade I always the .extroot-uuid problem described in official Extroot documentation , so you need delete it after upgrade and reboot


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.