Task 3 โ€” Database Recovery with RAID 4 18 marks

Six data disks, one dedicated parity disk, 4-bit blocks. Draw the structure (6), compute the parity block, and recover D5 after a disk failure โ€” plus 12 viva marks.

What RAID 4 is

RAID (Redundant Array of Independent Disks) Level 4 = block-level striping with a dedicated parity disk. Data is split into fixed-size blocks written across the data disks; a seventh disk stores a parity block computed as the bitwise XOR of the corresponding blocks on every data disk. Any one failed disk can be rebuilt by XOR-ing everything that survives.

3(a) โ€” RAID Level 4 structure

RAID Controller (striping + parity) D11010Block 1Employeedata diskD21100Block 2Departmentdata diskD30111Block 3Attendancedata diskD41001Block 4Leavedata diskD50011Block 5Salarydata diskD61110Block 6Designationdata diskP0101Parity blockD1โŠ•โ€ฆโŠ•D6dedicated parity diskBlock-level stripingOne stripe = one block on every data disk + one parity block on P.Parity ruleP = D1 โŠ• D2 โŠ• D3 โŠ• D4 โŠ• D5 โŠ• D6 ย ยทย  and any Dk = P โŠ• (all other disks)BottleneckEvery write also writes P, so the single parity disk is the write bottleneck (fixed by RAID 5โ€™s distributed parity).
RAID 4 โ€” 6 data disks + 1 dedicated parity disk, 4 bits per block.

3(b) โ€” Parity calculation

Blocks stored in the array:

BlockDescription4-bit valueDisk
Block 1Employee data1010D1
Block 2Department data1100D2
Block 3Attendance data0111D3
Block 4Leave data1001D4
Block 5Salary data0011D5
Block 6Designation data1110D6

Method 1 โ€” bit-by-bit (count the 1s)

XOR of a column = 0 if the number of 1s is even, 1 if it is odd (even parity).

Bit positionD1D2D3D4D5D6# of 1sP = XOR
Bit 3 (MSB)1101014 (EVEN)0
Bit 20110013 (ODD)1
Bit 11010114 (EVEN)0
Bit 0 (LSB)0011103 (ODD)1

Method 2 โ€” running XOR, block by block

StepOperationResult
11010 โŠ• 11000110
20110 โŠ• 01110001
30001 โŠ• 10011000
41000 โŠ• 00111011
51011 โŠ• 11100101
Parity disk stores P = 0101 โ€” and both methods agree, which is the check you should show in the viva.

3(c) โ€” Recovering the failed disk D5

D5 (Salary data) fails. XOR is its own inverse, so from P = D1 โŠ• D2 โŠ• D3 โŠ• D4 โŠ• D5 โŠ• D6 we can XOR both sides by every surviving disk:

D5 = P โŠ• D1 โŠ• D2 โŠ• D3 โŠ• D4 โŠ• D6

Bit-by-bit

Bit positionPD1D2D3D4D6# of 1sD5 = XOR
Bit 3 (MSB)0110114 (Even)0
Bit 21011014 (Even)0
Bit 10101013 (Odd)1
Bit 0 (LSB)1001103 (Odd)1

Running XOR

StepOperationResult
10101 โŠ• 10101111
21111 โŠ• 11000011
30011 โŠ• 01110100
40100 โŠ• 10011101
51101 โŠ• 11100011
Recovered D5 = 0011 โ€” exactly the original Salary-data block (0011). A single-disk failure is fully recovered from parity: that is the reliability guarantee of RAID 4.

Why this matters for recovery โ€” and RAID 4โ€™s limits

PropertyRAID 4
Disks tolerated failingExactly one. Two failures in a stripe lose the data โ€” one equation, two unknowns.
Storage overhead1 disk out of 7 โ‰ˆ 14 % (vs 50 % for RAID 1 mirroring).
ReadsFast and parallel โ€” different blocks come from different disks; P is not read.
WritesBottlenecked. Every write updates P, so the parity disk serialises all writes (the โ€œsmall writeโ€ problem).
Efficient parity updatePnew = Pold โŠ• Dold โŠ• Dnew โ€” 2 reads + 2 writes, no need to read every disk.
ComparisonRAID 0 = striping, no redundancy ยท RAID 1 = mirroring ยท RAID 5 = RAID 4 with parity distributed across all disks (removes the bottleneck) ยท RAID 6 = two parity blocks, survives two failures.
RAID protects against media/disk failure only. It is not a backup: a wrong DELETE, a dropped table or a ransomware write is faithfully striped across all disks. Full database recovery still needs log-based recovery (undo/redo, WAL, checkpoints) plus off-site dumps โ€” mention this, it is a favourite follow-up question.