Derivation. Let data blocks be D1,D2,…,Dn−1 across n−1 disks. Define parity:
P=D1⊕D2⊕⋯⊕Dn−1
Suppose disk k dies. We know all other Di and P. XOR everything we still have:
D1⊕⋯⊕Dk−1⊕Dk+1⊕⋯⊕P
Substitute P and use ⊕ properties: x⊕x=0 and x⊕0=x. Every surviving block
cancels its own copy inside P, leaving:
=Dk
For RAID 6 we add a second, independent parity Q using Reed–Solomon over a Galois field GF(28):
Q=⨁igi⋅Di
Two independent equations (P and Q) let you solve for two unknowns → survives 2 disk failures.
Imagine you and friends each copy one page of a comic. RAID 0: everyone holds a different page — super
fast to read all at once, but if one friend loses their page the comic is ruined. RAID 1: two friends
hold the same pages, so if one drops out the other still has it. RAID 5: each friend also writes down
a magic "summary number" so that if any one friend vanishes, the rest can rebuild the missing page from the
summary. RAID 6: two magic summaries, so even if two friends vanish you're fine. RAID 10: pair up
friends as backups, then split the comic across the pairs — fast and safe.
Dekho, ek single disk ke do problem hote hain: woh slow hoti hai (sirf ek hi head se padh-likh sakti hai)
aur fragile hoti hai (ek failure matlab pura data gaya). RAID ka idea simple hai — kai disks ko mila ke ek
bada logical disk banao, taaki tum speed, reliability, ya dono khareed sako. Lekin har level mein
tumhe kuch na kuch pay karna padta hai: capacity, paisa, ya write speed.
Levels yaad rakhne ka tareeka: RAID 0 = sirf striping, sabse fast par zero safety — ek disk gayi to sab
gaya. RAID 1 = mirroring, har disk ka exact copy, par aadhi capacity barbaad. RAID 5 = striping +
ek parity block jo XOR se banta hai aur saari disks par ghoomta hai; ek disk fail ho to parity se rebuild ho
jaati hai (capacity n−1, tolerate 1). RAID 6 = do parity (P aur Q), do disk failures tak survive
(capacity n−2). RAID 10 = pehle mirror, phir stripe — fast bhi, safe bhi, par mehnga.
Parity ka magic XOR hai: P=D1⊕D2⊕⋯. Agar koi block missing ho jaye, to baaki sab ko
parity ke saath XOR karo aur missing block wapas mil jata hai, kyunki x⊕x=0. Yeh sirf ek missing
piece fix kar sakta hai — isliye RAID 5 sirf 1 failure handle karta hai. Ek important point: chhoti write
mein RAID 5 ko 4 I/O lagte hain (purana data + purana parity padho, naya data + naya parity likho), isliye
parity levels write-heavy databases ke liye slow hote hain — wahan RAID 10 better hai.
Sabse bada exam-trap: RAID ko backup mat samajhna! RAID disk failure se bachata hai, par galti se delete,
virus, ya fire se nahi — kyunki woh galti turant mirror par bhi copy ho jaati hai. Backup alag cheez hai.