RAID setup

From Elvanör's Technical Wiki
Jump to navigation Jump to search

Concepts

Types

  • A RAID setup can either be hardware (hardware card that includes a RAID controller, in this case no drivers are needed) or software (in this case Linux drivers are needed). There is a third type called firmware RAID that is neither software nor hardware. It seems no drivers are needed but there is a burden on the host CPU.

Possible setups

  • RAID 0 is stripping: basically two drives combined into one big drive. If one drive breaks, all data is lost so this is risky.
    • With software RAID 0, you cannot have /boot on the stripped partition (at least not with GRUB 0.97). You need a separate /boot partition that is not on the RAID 0 array.
    • RAID 0 needs to have all partitions of different drives of the same size. This basically means that if you have 2x100GB drive, and you create a 1GB partition on the first drive, the maximum RAID 0 size combining the two disks will be 2x99GB, not 99GB+100GB.
  • RAID 1 is mirroring. There is redundancy but at a high cost.

Tools

  • mdadm is used to create the RAID arrays:
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

When creating the array mdadm can complain about the previous presence of a filesystem. You can use mkswap to remove the filesystem (later you will probably reformat the RAID array, so that's safe). It can also tell you to use --metadata=0.90 format. Indeed if you use GRUB legacy, and a setup without initrd, you cannot use RAID 1 with a metadata format higher than 0.90.

  • To deactivate a RAID array:
mdadm --stop /dev/md1
  • To deassociate the partitions from a RAID array:
mdadm --zero-superblock /dev/sda1
mdadm --zero-superblock /dev/sdb1
  • To obtain the status of an array:
mdadm --detail /dev/md1

Rocky Linux Installer

  • The Rocky Linux graphical installer supports creating RAID arrays (and more generally, a totally custom partitioning of hard drives). Its interface is not very intuitive though compared to fdisk/gparted.

LVM2

  • LVM is a set of userspace tools that allows dynamic resizing of partitions without rebooting and other stuff like that. Untested yet.