### Protection for disk crashes

• Recovering from disk crashes

• Only way to recover from a disk crash:

 Redundancy (e.g., backup copy)

• Techniques that deploy redundancy:

 disk mirroring RAID (Redundant Array of Independent Disks)

• Disk mirroring

• Mirroring:

• A disk is a logical unit

• Physically a disk consists of two (physical) disks

• Write data to the disk:

 Write data to both disks

• Read data from the disk:

 Read data from any one of disks

• Read operation can be twice as fast

 Because you can use one disk to process half of the read requests and use the 2nd disk to process the other half of the read requests

(Write operation is about the same speed)

 Very expesnive (you must use twice the number of hard disks !!!)

• RAID: Redundant Array of Independent Disks - level 4

• Comment:

 The RAID technique has many "levels" RAID level 1 = the same as disk mirroring

• RAID level 4:

• Use n disks as follows:

 n − 1 disks are normal disks (i.e., you write data blocks to these disks)

• Disk n is a parity disk:

 Every sector on disk n stores the result of the parity value of all the (corresponding) sectors on the other n − 1 disks

Example:

• Read operation from a (data) disk:

• A read operation will access a "normal" data disk

• The read operation is processed in the same way as without RAID

I.e.:

 No special procedure is necessary to read data in RAID level 4

• Write operation to a (data) disk:           (you must also update the parity !!!)

 Write the data to the (data) disk Compute the new value of the parity Write the new parity value to the parity disk

• Example: write operation

• Read the data from disk 2:

• Suppose we update the data to 1111:

• Update the data disk:

• Update the parity disk:

The new value of the parity disk is computed as follows:

 ``` new-parity = old-parity XOR ( new-data XOR old-data ) ```

This will ensure that:

 ``` parity disk = disk1 XOR disk2 XOR disk3 ```

• RAID - level 5

• Problem with RAID level 4:

• Each write operation must update the parity disk

Result:

 The parity disk will likely to become a bottleneck !!!

• RAID Level 5 protocol:

• Parity cylinder !!!

• Use a finer granularity to compute the parity: cylinder

• The parity cylinder is located on different disks.

E.g.:

 Cylinder 1: the parity cylinder is located on disk 1 Cylinder 2: the parity cylinder is located on disk 2 And so on...

Example: