RAID
RAID
1
Addressing and Geometry
• Externally, hard drives expose a large number of sectors
(blocks)
– Typically 512 or 4096 bytes
– Individual sector writes are atomic
– Multiple sectors writes may be interrupted (torn write)
• Drive geometry
– Sectors arranged into tracks
– A cylinder is a particular track on multiple platters
– Tracks arranged in concentric circles on platters
– A disk may have multiple, double-sided platters
• Drive motor spins the platters at a constant rate
– Measured in revolutions per minute (RPM) 2
Geometry Example
Sector Three tracks
12
11 13
23 24 25
10 14
32
9 22 31 33 26 15
Rotation
8 21 30 34 27 0 Read head
7 20 29 35 16 1
28 Seeks across the
6 19
18
17 2 various tracks
5 3
4
4
RAID 0: Striping
• Key idea: present an array of disks as a single large disk
• Maximize parallelism by striping data cross all N disks
5
Addressing Blocks
• How do you access specific data blocks?
– Disk = logical_block_number % number_of_disks
– Offset = logical_block_number / number_of_disks
• Example: read block 11
– 11 % 4 = Disk 3
– 11 / 4 = Physical Block 2 (starting from 0)
Disk 0 Disk 1 Disk 2 Disk 3
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15 6
Analysis of RAID 0
• Capacity: N
– All space on all drives can be filled with data
• Reliability: 0
– If any drive fails, data is permanently lost
• Sequential read and write: N * S
– Full parallelization across drives
• Random read and write: N * R
– Full parallelization across all drives
7
RAID 1: Mirroring
• RAID 0 offers high performance, but zero error
recovery
• Key idea: make two copies of all data
Disk 0 Disk 1
0 0
1 1
2 2
3 3
8
Disk 0 Disk 1 Disk 2 Disk 3 Analysis of RAID 1 (1)
0 1 0 1
2 3 2 3 Disk 0 Disk 1 Disk 2 Disk 3
4 5 4 5
6 7 6 7 skipped 0 1 0 1
Each 2 3 2 3
block is 4 5 4 5
wasted 6 7 6 7
0 1 0 1
2 3 2 3
4 5 4 5
6 7 6 7
10
RAID 0+1 and 1+0 Examples
0+1 1+0
Mirror Stripe
0 1 0 1 0 0 1 1
2 3 2 3 2 2 3 3
4 5 4 5 4 4 5 5
6 7 6 7 6 6 7 7
12
Analysis of RAID 4
• Capacity: N – 1
– Space on the parity drive is lost
• Reliability: 1 drive can fail
• Sequential Read and write: (N – 1) * S
– Parallelization across all non-parity blocks
• Random Read: (N – 1) * R
– Reads parallelize over all but the parity drive
• Random Write: R / 2
– Writes serialize due to the parity drive
– Each write requires 1 read and 1 write of the parity drive, thus
R/2
13
RAID 5: Rotating Parity
15
Comparison of RAID Levels
Read D D D D
Write D D 2*D 2*D
16
RAID 6
Disk 0 Disk 1 Disk 2 Disk 3 Disk 4
18