Part 6 of 6 · 3 min read
Exercises
Easy
Easy 1: Parity byte (20 minutes)
Find the parity byte of the data bytes 0x0F, 0xF0 and 0xFF.
Done when: 0x00, from 0x0F XOR 0xF0 = 0xFF and 0xFF XOR 0xFF = 0x00.
Hint
XOR the first two, then XOR the result with the third.
Easy 2: Capacity (20 minutes)
Five disks of 2 TB each. Give the usable capacity for RAID 0, RAID 5 and RAID 6.
Done when: 10 TB, 8 TB and 6 TB.
Hint
RAID 5 loses one disk, RAID 6 loses two.
Easy 3: Recover a byte (20 minutes)
In a stripe, the parity byte is 0x5A and the two surviving data bytes are 0x0F and 0x33. Recover the lost byte.
Done when: 0x66, from 0x5A XOR 0x0F = 0x55 and 0x55 XOR 0x33 = 0x66.
Hint
XOR the parity with the surviving bytes.
Medium
Medium 1: Random writes (45 minutes)
Eight disks give 200 random operations per second each. Find the random write rate of RAID 10 and RAID 5.
Done when: 800 (8 x 200 / 2) and 400 (8 x 200 / 4).
Hint
random writes = disks x rate / operations per write.
Medium 2: Rebuild time (45 minutes)
A 8 TB disk is rebuilt at 80 MB/s. How many hours does the rebuild take? If the disk's yearly failure chance is 2%, say in words why a longer rebuild makes a second failure in a RAID 5 more likely.
Done when: 100,000 s which is 27.8 hours, and a sentence about the longer window.
Hint
seconds = bytes / rate, then divide by 3,600.
Medium 3: Run and check (45 minutes)
Compile the program of section 3. Change the failed disk to disk 0 and the small write to stripe 2. Check that it still prints "matches" and "equals".
Done when: both messages appear after your change, and you name the lines that you edited.
Hint
change both the index of the failed disk and the stripe index of the write.
Hard
Hard 1: Two failures (90 minutes)
A RAID 10 has eight disks in four mirrored pairs. After one disk fails, what is the chance that a second random failure kills the array? Repeat for after two failures in different pairs.
Done when: 1 in 7 (about 14.3%) for the first, and 2 in 6 (33.3%) for the second case, with the reasoning.
Hint
after the first failure seven disks remain and only one is the partner.
Hard 2: Extend to two parities (90 minutes)
Explain in words why a second parity block cannot be a second copy of the first XOR, and what a RAID 6 needs instead. You may name Reed-Solomon codes or diagonal parity.
Done when: a paragraph that says that two equal blocks give one equation and two missing blocks need two independent equations.
Hint
count unknowns and equations.
Hard 3: A write-hole (90 minutes)
A RAID 5 updates a data block and then crashes before it updates the parity. Describe what happens when a different disk of that stripe later fails and the array is rebuilt. State one way of avoiding the problem.
Done when: a description that says that the rebuild uses the old parity with the new data and produces wrong data, and a remedy such as a journal, a battery-backed cache or copy-on-write.
Hint
parity no longer equals the XOR of the data on that stripe.