Raid

From Newroco Tech Docs
Jump to navigationJump to search

RAID types

An overview of the commonly used Redundant Array of Independent Disks (RAID) levels. Levels 2,3 & 4 are almost never used now - and rarely ever, so are not covered here.

RAID0

Rarely used now, RAID0 just split data across 2 or more disks, providing for greater volumes than could be provided by a single disk - particularly desirable when hard drives were much smaller than now. It's rarely used now as it provide little advantage over a single disk as it has no resilience; if a single disk fails, the volume is lost. It can still be used for providing raw performance (with read/write load split across many spindles) but there are alternatives with greater resilience.

RAID1

The first level of RAID to provide fault tolerance, RAID1 is also known as disk mirroring and usually consists of 2 disks (or 2 partitions) of equal size, with all data written to both; loss of one disk does not impact the data availability. Sometimes combined with RAID0 to make the hybrid RAID10, with both 1 & 10 having the same issue; for every 2 disks added, only one is available as storage capacity.

RAID5

A common RAID level, RAID5 uses a minimum of 3 disks to split data and parity information across the set; while each data block only exists on a single disk, the parity information being present on another disk means RAID5 arrays can lose a single disk without losing data as the parity bits can be used to recreate the missing blocks on a replacement disk. Commonly used with a hot spare to allow for automatic rebuilds in the event of a disk failure, RAID5 allows building very large volumes that are resilient to hardware failure without "losing" too much capacity.

RAID6

Increasingly common for larger volumes, 6 extends the 5 architecture with a second parity copy, which means it needs a minimum of 4 drives, with 2 of any array being unavailable as storage capacity. In very large arrays, this cost is relatively small, given the upside is the array can lose 2 drives at once without loss of data.

Software v. hardware

Software RAID

Notes on software RAID in Linux. This is often the best all round option for simple RAID setups (2 disk RAID1 as in this example) even if there is a hardware option available - because it'll just work now and onwards.

Software RAID is best initiated during install, although it's possible to make a working installation and add a mirrored disk. The important feature of a RAID array (all but RAID0) is their ability to prevent data loss in the event of disk failure.

In the event of a disk failing you should replace the failed drive as soon as possible and replace it with a similar (or larger; the smaller of a pair will set the space usage limit) drive. With the machine booted, remove the failed device:

mdadm --remove /dev/md0 /dev/sda1

If you don't know which drive failed, try

cat /proc/mdstat

Then with the new drive in place (hot swapped if supported, after a shutdown and cold swap if not), add

mdadm --add /dev/md0 /dev/sda1

Note the "sda1" part won't necessarily be the same in the steps or on your system, depending on your hardware and how the new drive was installed.

Then to recreate the array do

mdadm --assemble --scan

Depending on how your array was configured and which device failed, you may also need grub help to boot up.


How to set up software RAID 1 on a running system

How_to_set_up_software_RAID_1_on_a_running_system_(_Incl_GRUB_2_configuration_)

How_to_set_up_software_RAID_1_on_a_running_system_(_Incl_UEFI_boot_mechanism_)