RAIDs utilizing parity function(s)
RAID 5 utilizes the combination of striping and parity techniques.
In case of RAID 5 the flow of data is split into the blocks of a certain size (block size) which are then written onto the member disks in turn.
In each row one of the disks is assigned to store a certain checksum, so called parity function,
which is calculated based on the data from other member disks in the row.
In case of a single disk failure, the missing data can be calculated using the parity.
In such a way fault tolerance is provided.
A minimum of three disks is required for RAID 5.
Theoretically, the maximum number of the disks is not limited, but in practice, it is needed to take into account
the controller capacity in case of a hardware RAID.
The capacity of the array is (N-1) times the size of the smallest member disk for the array of N disks.
Thus, the capacity of one disk is used to store the parity function data to provide fault tolerance.
Reads in a RAID5 array
Read speed in RAID 5 is the similar to that of RAID 0 provided that the number of disks is the same.
However, due to the fact that it is useless to read the parity data, the read speed is just (N-1) times faster but not N times as in RAID 0.
Writes in a RAID5 array
Writing data with the size less than the block size requires the following actions to be done:
- Read the old data block;
- Read the old parity block;
- Compare data in the old block with the newly arrived one. For every changed bit, change the corresponding bit in parity.
- Write the new data block;
- Write the new parity block.
As can be seen, the parity updates decrease the system write performance.
For writes which are equal to or bigger than the size of a row consisting of N data blocks, write speed is a bit faster because it is not required to read the old blocks and look for changes.
RAID 5 layouts
There are four different types of RAID 5 depending on where the parity blocks are located
and in which order the data blocks are written (note that the first block in each row is colored red in the diagrams below):
Left and right arrays are determined by how the parity blocks are distributed onto the member disks.
Synchronicity and asynchronicity define the order of the data blocks.
For RAID 5 recovery, all these parameters should be detected in addition to the block size,
the start offset, and the order of the member disks.
RAID 6 uses both striping and parity techniques but unlike RAID 5
utilizes two independent parity functions which are then written to two member disks.
Typically, one of these parity functions is the same as in RAID 5 (xor function), while the second is more complex.
The parity data helps to recover data in case of simultaneous failure of two member disks.
A minimum of four disks is required to create RAID 6.
The capacity of the array is (N-2) times the size of the smallest member disk for the array of N disks.
Read speed is (N-2) times faster than in case of a single disk - two disks in the row hold a parity which is useless to read.
Such read speed values are roughly the same as in RAID 5.
There is no performance increase as to the write speed in RAID 6,
because every new write requires a recalculation and update of two different parity blocks.
RAID 6 is rather expensive storage option.
However, when it is needed a large and reliable storage, then RAID 6 is one of the best choices,
because it protects data if two disks failure happens. This can occur when:
- an array is rebuilding (so called rebuild time);
- a wrong disk is hot-swapped due to operator error.
When one disk is missing from a RAID 5 set, there is a certain speed penalty because the data stored on a missing disk must be recalculated.
However, the recalculation is still significantly faster than having to try to read a physically damaged drive.
Hence, you should avoid using drives that are known to be physically damaged (multiple bad sectors or similar issues) for recovery.
Although the RAID 6 can be rebuilt by the controller with N-2 disks available, ReclaiMe Free RAID Recovery requires N-1 disks to recover RAID6.