RAID Levels
RAID 0 | Stripes data evenly across two or more disks. |
RAID 1 | Mirrors data on two or more disks. |
RAID 2 | Rarely used, Bit-level striping with Hamming code for error correction. |
RAID 3 | Rarely used, byte-level striping with a dedicated parity. |
RAID 4 | Block-level striping with dedicated parity. |
RAID 5 | Block-level striping with distributed parity. |
RAID 6 | Block-level striping with double distributed parity. |
Nested RAID Levels
Number | Description | Efficiency |
RAID 01 | Block-level striping, and mirroring without parity | 1/stripes |
RAID 10 | Mirroring without parity, and block-level striping | stripes/n |
RAID 50 | Block-level striping with distributed parity, and block-level striping | (1-stripes)/n |
RAID 60 | Block-level striping with double distributed parity, and block-level striping | (1-2*stripes)/n |
Formatting Disks for Use with mdadm
DISCLAIMER: PROCEED WITH CAUTION. |
MAKE SURE YOU KNOW WHAT DISK YOU ARE OPERATING ON. IT IS VERY EASY TO DO IRREVOCABLE DAMAGE TO YOUR SYSTEM IF YOU DON’T. |
0. Figure out disk location in the file system: |
lsblk -o name,size,fstype,type,mountpoint |
1. Formatting with fdisk |
sudo fdisk /dev/sdx |
2. Navigatng fdisk: just press the following keys when promted to create new linux RAID type primary partition |
n , p , 1 , Enter , Enter , t , fd , w |
3. Repeat steps 1 and 2 for each disk that will be included in new array |
sudo fdisk /dev/sdy |
n , p , 1 , Enter , Enter , t , fd , w |
Creating RAID arrays
Create a mirrored array |
mdadm –create /dev/md0 –level=1 /dev/sdx1 /dev/sdy1 |
Assembling RAID arrays
Assemble an existing array |
mdadm --assemble /dev/md0 /dev/sdx1 /dev/sdy1 |
mdadm --scan --assemble --uuid=<UUID> |
Resetting Existing RAID Devices
Find the active arrays |
cat /proc/mdstat |
Unmount the array |
sudo umount /dev/md0 |
Stop and remove the array |
mdadm --stop /dev/md0 |
mdadm --remove /dev/md0 |
Find the devices used to build the array |
lsblk -o name,fstype,mountpoint |
Zero out the respective superblocks |
sudo mdadm --zero-superblock /dev/sdx |
sudo mdadm --zero-superblock /dev/sdy |
Remove persistent references to the array |
sudo nano /etc/fstab |
Comment out or remove the reference to the array. |
# /dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0 |
In /etc/mdadm/mdadm.conf comment out or remove the array reference |
sudo nano /etc/mdadm/mdadm.conf |
Comment out the reference |
# ARRAY /dev/md0 metadata=1.2 name=mdadmwrite:0 UUID=xxxx |