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
- RAID1 with less storage for the OS and "important" stuff.
- RAID0 with the remaining storage across all 4 of the disks (Linux ISOs).
- Create empty partitions using
fdisk. Ended up with:/dev/sda5,/dev/sdb5etc.-
fdisk /dev/sda-
n(new partition)- Note the partition number. For me the last partition number ended up being
5for all disks, which I used in themdadmcommand later.
- Note the partition number. For me the last partition number ended up being
- Select start block, end block etc. (or just leave default to use remaining space)
-
wto write partition table
-
-
- 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
lsblkto verify that/dev/md3isn't already taken. When I raninstallimageI ended up with:-
md0= swap -
md1= boot -
md2= root partition (/)
-
-
- Run
mdadm --detail --scanand 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.confso 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.
- A lot of tutorials suggest piping that to
- Double check that
/etc/mdadm/mdadm.conflooks correct, then runupdate-initramfs -uso that the RAID array is available during the boot process.
- TODO: Creating filesystem, mounting, append to fstab.