I still did not get why is RAID5 better than RAID4. I understand both computes parity bits that are used for recovering if some failure occurs, the only difference is in storing those parity bits. I have borrowed diagrams from here How does parity work on a RAID-5 array
A B (A XOR B)
0 0 0
1 1 0
0 1 1
1 0 1
RAID4
Disk1 Disk2 Disk3 Disk4
----------------------------
data1 data1 data1 parity1
data2 data2 data2 parity2
data3 data3 data3 parity3
data4 data4 data4 parity4
Lets say that first row is:
data1 = 1
data1 = 0
data1 = 1
parity1 = 0 (COMPUTED: 1 XOR 0 XOR 1 = 0)
RAID5
Disk1 Disk2 Disk3 Disk4
----------------------------
parity1 data1 data1 data1
data2 parity2 data2 data2
data3 data3 parity3 data3
data4 data4 data4 parity4
Lets say that first row is:
parity1 = 0 (COMPUTED: 1 XOR 0 XOR 1 = 0)
data1 = 1
data1 = 0
data1 = 1
Scanarios:
1. RAID4 - Disk3 FAILURE:
data1 = 1
data1 = 0
data1 = 1 (COMPUTED: 1 XOR 0 XOR 0 = 1)
parity1 = 0
2. RAID4 - Disk4 (parity) FAILURE:
data1 = 1
data1 = 0
data1 = 1
parity1 = 0 (COMPUTED: 1 XOR 0 XOR 1 = 0)
etc.
In general: when RAID(4 or 5) uses N disks and one fails. I can take all remaining non failed disks (N-1) and XOR (since XOR is associative operation) values and I will get the failed value. What is the benefit of storing parity not on dedicated disk but rather cycle them? Is there some performance benefit or what? Thank you