A minimum of 5 HDDs is needed to create a RAID 6. Thanks to two different parities, this RAID system can tolerate a loss of 2 HDDs.
Let's say we have a 5 HDDs RAID 6. The files are divided in blocks of X sectors. The first block is written on the first HDD, the second block on the second HDD, the third block on the third HDD.
Once these 3 blocks are written on the 3 HDDs, a first parity calculation is made according to these 3 blocks. This parity is written on the fourth HDD. Then a second parity is calculated with another method and is written on the fifth HDD. Once these two parities are saved, the next data blocks are written following the same process.
To avoid having all the parities on the same HDDs, the parities are written each time on a different HDD in a cyclic way.
The loss of 2 HDDs (so 2 data blocks per line) can be recalculated, thanks to the double parity.
When changing a defective HDD, the missing data is automatically recreated, thanks to thew other HDDs of the RAID 6.
Because of this double parity of the RAID 6, 2 HDDs can't be used to store the data. It means the total RAID 6 volume will be the volume of 3 HDDs here (5 - 2).
The common RAID 5 failures are :