RAID 5 is storage solution giving consideration to storage performance, data security and storage cost. Take RAID 5 composed of 4 disks for example. Its data storage is shown in picture 4. P0 is parity information of D0, D1 and D2 and so on. It is figured that
RAID 5 does not backup storage data, but store data and corresponding parity information in each disk of RAID 5, and parity information ad corresponding data are distinctively stored in different disks. When data is damaged in one disk, the left data and corresponding parity information are used to recover the damaged data.
RAID 5 can be considered as a compromise solution between
RAID 0 and
RAID 1.it provides data security for system. But
Its security degree is lower and space utilization rate is higher than that of Mirror. Data read speeds of RAID 5and RAID 0 are nearly the same. But RAID 5 has parity information, so its speed of data writing is lower than that of single disk. As many data are corresponding with one parity information, the disk space utilization rate of RAID 5 is higher than that of RAID 1, and its storage cost is lower.
Algorithm Principle of RAID5 Check Bit
P=D1 xor D2 xor D3 … xor Dn (D1, D2, D3 … Dn are data blocks, P is parity, xor is operation)
Parity algorithm principle of XOR(
Exclusive OR)is following in the table:
Value A Value B Xor Result
0 0 0
1 0 1
0 1 1
1 1 0
Value A and value B stand for two bits. It can be found if A is the same as B, and the XOR result is 0 and if A is different with B, the XOR result is 1. If XOR result and A/B are known, the other value can be calculated. For example, if A is 1 and XOR is 1, then B must be 0. And if A is 1 and XOR is 0, then B must be 1. That is the basic principle of XOR encoding and parity.
Read-Write Process of RAID 5
Simply speaking, RAID 5 disk array is composed of at least 3 disks. If there is only one disk, data is written directly into the
track of this disk. But in RAID 5, data writing is divided into 3 parts and written in these 3 disks. And parity information is written down at the same time. The written data will be read from those 3 disks respectively, and then they are checked through the checking information. When one disk is damaged, its data information can be calculated from the data stored in the other 2 disks. That means RAID 5 only allows one disk damaged and the damaged disk should be replaced timely. After the replacement, the data written during the disk failure period will be re-checked. If two disks fail at the same time, it will be catastrophic.