0% found this document useful (0 votes)
14 views18 pages

RAID

RAID

Uploaded by

Sakib Adil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views18 pages

RAID

RAID

Uploaded by

Sakib Adil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

A Multi-Platter Disk

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

Outer tracks hold


One platter
more data 3
Redundant Array of Inexpensive Disks
• RAID: use multiple disks to create the illusion of a
large, faster, more reliable disk
• Externally, RAID looks like a single disk
– i.e. RAID is transparent
– Data blocks are read/written as usual
– No need for software to explicitly manage multiple disks or
perform error checking/recovery
• Internally, RAID is a complex computer system
– Disks managed by a dedicated CPU + software
– RAM and non-volatile memory
– Many different configuration options (RAID levels)

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

Disk 0 Disk 1 Disk 2 Disk 3


Data block = Random accesses
Sequential 0 1 2 3
512 bytes
accesses are naturally
4 5 6 7 spread over all
spread across
8 9 10 11 Stripe
drives
all drives
12 13 14 15

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

• Capacity: N / 2 • Sequential write: (N / 2) * S


– Two copies of all data, thus half – Two copies of all data, thus
capacity half throughput
• Reliability: 1 drive can fail, • Sequential read: (N / 2) * S
sometime more – Half of the read blocks are
wasted, thus halving
– If you are lucky, N / 2 drives can fail throughput
without data loss
9
Analysis of RAID 1 (2)
• Random read: N * R
– Best case scenario for RAID 1
– Reads can parallelize across all disks
• Random write: (N / 2) * R
– Two copies of all data, thus half throughput

Disk 0 Disk 1 Disk 2 Disk 3

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

Stripe Stripe Mirror Mirror


Disk 0 Disk 1 Disk 2 Disk 3 Disk 0 Disk 1 Disk 2 Disk 3

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

• Combines striping and mirroring


• Superseded by RAID 4, 5, and 6 11
RAID 4: Parity Drive
Disk 0 Disk 1 Disk 2 Disk 3 Disk 4

0 1 2 3 P0 Disk N only stores


4 5 6 7 P1 parity information
8 9 10 11 P2 for the other N-1
12 13 14 15 P3 disks

Disk 0 Disk 1 Disk 2 Disk 3 Disk 4


0 0 1 1 0^0^1^1=0 Parity
0 1 0 0 0^1^0^0=1 calculated
1 1 1 1 1^1^1^1=0 using XOR
0 1 1 1 0^1^1^1=1

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

Disk 0 Disk 1 Disk 2 Disk 3 Disk 4

0 1 2 3 P0 Parity blocks are


5 6 7 P1 4 spread over all N
10 11 P2 8 9 disks
15 P3 12 13 14

Disk 0 Disk 1 Disk 2 Disk 3 Disk 4


0 0 1 1 0^0^1^1=0
1 0 0 0^1^0^0=1 0
1 1 1^1^1^1=0 1 1
1 0^1^1^1=1 0 1 1
14
Analysis of Raid 5
• Capacity: N – 1 [same as RAID 4]
• Reliability: 1 drive can fail [same as RAID 4]
• Sequential Read and write: (N – 1) * S [same]
– Parallelization across all non-parity blocks
• Random Read: N * R [vs. (N – 1) * R]
– Unlike RAID 4, reads parallelize over all drives
• Random Write: N / 4 * R [vs. R / 2 for RAID 4]
– Unlike RAID 4, writes parallelize over all drives
– Each write requires 2 reads and 2 write, hence N / 4

15
Comparison of RAID Levels

• N – number of drives • R – random access speed


• S – sequential access speed • D – latency to access a single disk
RAID 0 RAID 1 RAID 4 RAID 5
Capacity N N/2 N–1 N–1
Reliability 0 1 (maybe N / 2) 1 1
Sequential Read N*S (N / 2) * S (N – 1) * S (N – 1) * S
Throughput

Sequential Write N*S (N / 2) * S (N – 1) * S (N – 1) * S


Random Read N*R N*R (N – 1) * N*R
R
Random Write N*R (N / 2) * R R/2 (N / 4) * R
Latency

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

0 1 2 P00 P01 Two parity blocks


4 5 P10 P11 3 per stripe
8 P20 P21 6 7
P30 P31 9 10 11

• Any two drives can fail


• N – 2 usable capacity
• No overhead on read, significant overhead on write
• Typically implemented using Reed-Solomon codes
17
Choosing a RAID Level
• Best performance and most capacity?
– RAID 0
• Greatest error recovery?
– RAID 1 (1+0 or 0+1) or RAID 6
• Balance between space, performance, and
recoverability?
– RAID 5

18

You might also like