Skip to main content

Software RAID (mdadm) - Running RAID 0 alongside RAID 1

Draft - Incomplete, but kept mostly for my own sake so I can find my way back to it at a later date.

  • Specific scenario: Hetzner installimage with RAID1 or RAID10
  • RAID10 with less storage for the OS and "important" stuff.
    • Make sure to comment out the all option, that allocates the rest of the disks to say /home or similar.
  • RAID0 with the remaining storage across all 4 of the disks (Linux ISOs) that's easily replacable.
  1. Create empty partitions using fdisk. Ended up with: /dev/sda5, /dev/sdb5 etc.
    • fdisk /dev/sda
      • n (new partition)
        • Note the partition number. For me the last partition number ended up being 5 for all disks, which I used in the mdadm command later.
      • Select start block, end block etc. (or just leave default to use remaining space)
      • w to write partition table
  2. Create a new RAID0 array using new partitions, with mdadm:
    • mdadm --create --verbose /dev/md3 --level=0 --raid-devices=4 /dev/sda5 /dev/sdb5 /dev/sdc5 /dev/sdd5
    • Note: Might wanna check lsblk to verify that /dev/md3 isn't already taken. When I ran installimage I ended up with:
      • md0 = swap
      • md1 = boot
      • md2 = root partition (/)
  3. Run mdadm --detail --scan and find the line that matches /dev/md3. Copy that line and put it at the end of /etc/mdadm/mdadm.conf
    • A lot of tutorials suggest piping that to tee -a /etc/mdadm/mdadm.conf so it appends all the lines to the end of /etc/mdadm/mdadm.conf. In this case since there's already an existing RAID array, there will be duplicate lines and potential for conflicts.
  4. Double check that /etc/mdadm/mdadm.conf looks correct, then run update-initramfs -u so that the RAID array is available during the boot process.
  • TODO: Creating filesystem, mounting, append to fstab.