1

I'm currently thinking about installing the CoreOS on a bare-metal server with two disks I want to put in a software RAID1.

The latest CoreOS is now using EXT4 as their default filesystem and I'm fine with that - I've never used brtfs (their previous default) which apparently supports something close to a RAID1, and I'd rather stick to the default EXT4 and mdadm with which I already have experience.

I can assemble the RAID using mdadm (from a basic Linux environment loaded from the network) but I don't know what to do next, I'm pretty sure the CoreOS installer will wreck everything if I just give it the /dev/md0 as the target disk so let's not do that.

Did anyone successfully try this ?

1 Answer 1

2

The trick is to use right LABELS:

  • Setup SoftwareRAID for the CoreOS root partition
  • Only for ext4!
  • Assume CoreOS is on /dev/sdaX and the second RAID Device is /dev/sdb
  • Drawback: only / gets mirrored, Node goes down when sda fails

--

  1. Boot into any recovery system like Grml

  2. If not already done: install CoreOS

  3. Backup /dev/sda9

    mkdir -p /root/sda9
    mount /dev/sda9 /mnt
    rsync -a /mnt/* /root/sda9
    umount /dev/sda9
    
  4. Prepare the partition layout

    # delete sda9
    sgdisk /dev/sda --delete=9
    
    # create new /dev/sda9 partition (max size)
    START=`sgdisk /dev/sda -f`
    END=`sgdisk /dev/sda -E`
    sgdisk /dev/sda --new=9:$START:$END --type=9:fd00
    sleep 0.5
    partprobe /dev/sda
    
    # Remove partition table from sdb
    sgdisk --clear -g /dev/sdb || exit 1
    
    # create a partition sdb9 with the size of sda9
    PARTDATA=( $(sgdisk -i 9 /dev/sda | grep 'Partition size' || exit 1) )
    SECTORS=$(expr ${PARTDATA[2]} + 2048)
    sgdisk /dev/sdb -a 2048 --new=9:2048:$SECTORS --type=9:fd00 || exit 1
    sleep 0.5
    partprobe /dev/sdb
    
  5. Create the RAID

    mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda9 /dev/sdb9
    mkfs.ext4 -I 128 -L ROOT /dev/md0
    
  6. Copy the Data

    mount /dev/md0 /mnt
    rsync -a /root/sda9/* /mnt
    umount /mnt
    
  7. Wait until resync is finished

    watch -n 1 cat /proc/mdstat

  8. reboot!

Now we have ROOT on /dev/md0. I have not tried to put the other partitions (EFI-SYSTEM, BIOS-BOOT, USR-A, USR-B, OEM, CONFIG) on mdadm but it probably would work the same way.

3
  • Node goes down when sda fails the whole point of my RAID1 requirement is to have the system continue working until the sysadmins replace the failed drive.
    – user186340
    May 6, 2015 at 19:25
  • @André you can try it with the other partitions, just use the right lables
    – Psi
    May 7, 2015 at 7:49
  • hi, i have done this, but the problem is that the system does not scan for devices on boot, i have to wait for the emergency console and type mdadm --assemble --scan to continue
    – bara
    Jul 16, 2015 at 17:42

You must log in to answer this question.