目录
正在加载目录…
正在阅读专栏 OSTEP 操作系统专栏 第 30 篇 · 共 62 篇 · 48%

OSTEP:RAID

发布于 2026-09-17 21:40 · 最后编辑于 2026-09-17 22:08 · 版本 v2 · 字数 15,464 · 预计阅读 31 分钟 👁 19 次阅读

OSTEP:RAID

本篇对应 OSTEP Version 1.10 的 “Redundant Arrays of Inexpensive Disks (RAIDs)”。RAID 通过多个 disks 的并行与 redundancy,构造更大、更快、更可靠的 block device。

类型与定位

  • 笔记类型:深度分析
  • 翻译基准:官方 file-raid.pdf,Version 1.10。
  • 图件说明:原文的 striping、mirroring、parity layout、request path 与 degraded-mode 图按原位置改写为表格、Mermaid 和代码块;没有独立 raster image。

TL;DR

  • RAID 对上层呈现为一个线性的 logical block array,内部映射到多个 physical disks。
  • 评价 RAID 的三个维度是 capacity、reliability 和 performance。
  • RAID-0 striping 获得并行性能与全部容量,但没有 redundancy。
  • RAID-1 mirroring 简单可靠,读性能好,但 usable capacity 约减半。
  • RAID-4/5 用 parity 节省 redundancy space;small writes 需要 read-modify-write 或 reconstruct-write。
  • RAID controller、cache、rebuild、failure model 与 write durability 共同决定真实可靠性。

目录

章节内容
RAID 的目标larger、faster、reliable
Interface 与 fault modellogical blocks 与 fail-stop
评价维度capacity、reliability、performance
RAID-0striping
RAID-1mirroring
RAID-4/5parity redundancy
写入与 failure recoverysmall write、rebuild
选择 RAIDworkload trade-off

RAID 的目标

单个 disk 可能太慢、容量不足或不可靠。RAID 将多个 disks 组合成一个 block device:

mermaid
flowchart LR
  A[File system] --> B[Logical block interface]
  B --> C[RAID controller]
  C --> D[Disk 0]
  C --> E[Disk 1]
  C --> F[Disk 2]
  C --> G[Disk 3]

RAID 的透明性很重要:host OS 和 applications 仍按普通 disk 读写,不需要改写上层 software。

这种 transparency 不只是 interface 上的方便,也是 RAID 能够部署成功的重要原因:管理员可以用一个连接方式兼容的 RAID array 替换原来的 disk,而 host computer、OS 和 applications 都不需要修改。新功能如果能通过透明替换接入已有系统,通常比要求整个 software stack 重写更容易被采用。

RAID 本身并不是“几块 disk 加在一起”这么简单。hardware RAID 往往是一个专用 computer:包含运行 firmware 的 microcontroller、用于 buffer data 的 volatile DRAM,有时还包含安全保存 write 的 non-volatile memory,以及用于 parity calculation 的专用逻辑。上层看到的是 linear block array;内部则要把一个 logical I/O 拆成一个或多个 physical I/O。

Interface 与 fault model

RAID 对外提供从 0 开始编号的 logical blocks。收到 logical request 后,controller 根据 RAID level 计算涉及的 disk、offset 和 physical I/O 数量。

基本 fail-stop fault model 假定 disk 只有 working 或 failed 两种状态;failed disk 永久丢失且能被及时检测。这个模型暂不覆盖 silent corruption、latent sector error 和 controller bug,数据完整性章节再处理更复杂的 fault。

评价维度

设有 N 个每个包含 B 个 blocks 的 disks:

维度问题
Capacityclient 能使用多少 blocks?
Reliability能容忍多少 disk failures?
Performancesequential/random、read/write、small/large request 下有多快?

不同 RAID level 在这三个维度上做不同取舍。性能必须结合 workload 评估,不能只看理论 disk 数量。

RAID-0

striping 按 round-robin 将 logical blocks 分布在 disks 上:

Disk 0Disk 1Disk 2Disk 3
0123
4567
891011

给定 logical block A,简单 mapping 可以写成:

text
Disk   = A % number_of_disks
Offset = A / number_of_disks

多个 disks 可并行处理 contiguous request,容量为 N × B;但任何一个 disk failure 都可能丢失整个 array 的数据,因此 RAID-0 没有 reliability redundancy。

chunk size 决定 striping 粒度:chunk 越小,更多 request 能并行;chunk 越大,单个 request 可能集中到较少 disks。选择应匹配 workload。

Chunk size 的具体取舍

假设 4 个 disks、每个 chunk 为两个 4 KB blocks,则映射可以表示为:

Disk 0Disk 1Disk 2Disk 3
0, 12, 34, 56, 7
8, 910, 1112, 1314, 15

小 chunk 会让单个 file 更容易跨越多个 disks,从而增加单个 request 的 intra-file parallelism;代价是一次访问的 positioning time 取决于多个 disks 中最慢的那个。大 chunk 会减少单个 file 内部的并行度,但如果 file 或 request 能落在一个 chunk 内,定位只需支付一个 disk 的成本;此时要依靠多个同时到来的 requests 才能获得高吞吐。因此不存在脱离 workload 的“最佳 chunk size”,实际 array 常用的 chunk 会大于一个 block。

RAID mapping 的最小例子是 chunk size 等于一个 block:

text
disk   = A % N
offset = A / N       // integer division

例如 A = 14、N = 4 时,disk = 2、offset = 3。当 chunk size 改变时,先把 logical block address 换算成 chunk number 和 chunk 内 offset,再将 chunk number 进行 round-robin 分布。

RAID-1

mirroring 为每个 logical block 保存两份副本:

mermaid
flowchart LR
  A[Logical block A] --> B[Disk 0: A]
  A --> C[Disk 1: A]

N 个 disks 的 usable capacity 约为 N × B / 2。一个 disk failure 通常不会导致 data loss;read 可以选择任一副本,甚至并行读多个请求。write 必须更新所有 copies,且需要考虑 partial write、一致性和 power failure。

RAID-1 的优点是结构简单、rebuild 直接;缺点是 capacity overhead 高。多副本也不等于 backup:误删除或应用层错误仍会同步到所有副本。

RAID-4/5

parity-based RAID 用 XOR 等 parity 计算恢复信息。RAID-4 通常将 parity 集中在一个 disk,容易形成 parity-disk bottleneck;RAID-5 将 parity 分散到各 disks,降低热点。

以四个 data blocks 为例:

text
P = D0 XOR D1 XOR D2 XOR D3

任意一个 data block 丢失时,可用其余 data blocks 和 P 恢复:

text
D2 = P XOR D0 XOR D1 XOR D3

常见 RAID-5 条带:

stripeDisk 0Disk 1Disk 2Disk 3
0D0D1D2P0
1D4D5P1D6
2D8P2D9D10
3P3D11D12D13

usable capacity 约为 (N-1) × B,通常可容忍一个 disk failure。更多 parity 的 RAID level 可以容忍多个 failures,但需要额外 capacity 和计算。

RAID-4 的 parity 集中在一个 disk。对于 full-stripe write,controller 可以直接对新的 data blocks 做 XOR,再并行写入整个 stripe;但对于 small random write,更新一个 data block 还必须更新对应 parity。典型的 read-modify-write 需要读取 old data 与 old parity,计算新 parity,再写回 new data 与 new parity:

text
P_new = (D_old XOR D_new) XOR P_old

这会把一次 logical write 放大成四次 physical I/O。更早的 additive parity 方案也可以读取同一 stripe 的其他 data blocks 来重新计算 parity,但随着 data disks 增多,所需读取量会增长。RAID-4 中所有这些 small writes 都争用 parity disk,因此该 disk 会成为 bottleneck。

small write 更新 parity 有两种基本办法:

  • Additive parity:读取同一 stripe 中其余所有 old data blocks,把它们与 new data 做 XOR 得到 P_new,然后并行写入 new data 与 new parity。它的读取量随 data disks 数量增长。
  • Subtractive parity / read-modify-write:只读取 old data 与 old parity,再用差分更新 parity:
text
P_new = (D_old XOR D_new) XOR P_old

因此一次 small write 通常是两次 read 加两次 write。对于 block 而不是单 bit,这个公式仍然成立,只是 XOR 作用于整个 block 的每个 bit。若 new data 与 old data 相同,parity 不需要改变;一般情况下则必须同时更新 data 与 parity。

RAID-5 将 parity block 在各 disks 之间 rotating,使不同 stripe 的 parity 不再集中于一个 disk。这样不能消除 parity write amplification,但能让多个独立 small writes 分散到不同 disks 上并行执行;因此 RAID-5 基本保留 RAID-4 的 capacity、容错和 sequential 性能,同时改善 random write 的并行度。

XOR parity 的不变量

对于一组 data blocks,parity 是逐 bit 进行 XOR 的结果:

text
P = D0 XOR D1 XOR D2 XOR D3

RAID 维护的核心不变量是:每一个 bit position 上,包含 parity 在内的 1 的数量为偶数。于是丢失任意一个 data block 时,只要读取同一 stripe 的其他 data blocks 与 parity,就能用 XOR 重建它:

text
D2 = P XOR D0 XOR D1 XOR D3

这里的 XOR 不是只对一个抽象 bit 计算;实际是对 block 中每个 bit 做 bitwise XOR,因此可以直接应用于 4 KB 或更大的 block。

写入与 failure recovery

Full-stripe write

如果一次写覆盖完整 stripe,controller 可直接计算新 parity,再并行写入 data/parity,效率较好。

Small write

只更新一个 data block 时,常见 read-modify-write 流程是:读旧 data、读旧 parity、计算新 parity、写新 data 和 parity。也可以读取同一 stripe 的其他 data 并重建 parity。两者都会产生额外 I/O,这就是 parity RAID 的 small-write penalty。

Degraded mode 与 rebuild

disk failure 后,RAID 可用剩余 disks 和 redundancy 继续服务,但访问成本上升。rebuild 需要读取大量 blocks 并写入 replacement disk,期间 array 性能下降、剩余 disks 负担增加;若在 rebuild 完成前再次 failure 超出 redundancy 能力,可能发生 data loss。

故障期间,read 位于 failed disk 上的 block 不再是普通的单盘 read,而要读取同一 stripe 的 surviving blocks 与 parity 并重建结果。rebuild 则会扫描并恢复 failed disk 的全部内容;这段时间不仅用户请求更慢,剩余 disks 也承受额外读负载,所以第二次 failure 的风险窗口与潜在代价都很重要。hot spare 可以缩短等待 replacement 的时间,但不能消除 rebuild 本身。

mermaid
flowchart TD
  A[Detect failed disk] --> B[Enter degraded mode]
  B --> C[Use parity/mirror to serve requests]
  C --> D[Install replacement disk]
  D --> E[Read surviving blocks]
  E --> F[Reconstruct missing blocks]
  F --> G[Rebuild complete]

controller cache、battery-backed/non-volatile write buffer 和正确的 flush/barrier 语义会影响断电时的 consistency;“RAID 提供 redundancy”不自动意味着所有 write 都 durable。

选择 RAID

RAIDCapacityFailure tolerance适合场景
RAID-0最高0可丢失数据、追求吞吐
RAID-1约一半通常 1 个 disk/镜像组简单可靠、read-heavy
RAID-4约 (N-1)/N1 个 diskparity 集中、可能有热点
RAID-5约 (N-1)/N1 个 disk分散 parity、通用折中
多 parity RAID更低多个 disks大 array 与更强容错

实际设计必须结合 capacity、read/write pattern、request size、failure domain、rebuild time、backup 和 durability requirements。

简化性能对照

令单 disk 的 sequential bandwidth 为 S、random I/O rate 为 R,单次请求 latency 为 T:

RAIDSequential readRandom readRandom small writeWrite latency
RAID-0N × SN × RN × RT
RAID-1约 N/2 × SN × R约 N/2 × RT
RAID-4(N-1) × S(N-1) × R约 R/22T
RAID-5(N-1) × SN × R约 N/4 × R2T

这是用于建立直觉的简化模型;真实结果还会受到 queue depth、controller cache、request size、seek 并行度和 rebuild 的影响。RAID-1 的 mirror 也不是 backup:应用层误删、错误更新会被同步到副本。

这里还要区分两个 performance metric:

  • Single-request latency:一个 logical request 从开始到完成需要多久,能够体现一次请求内部可以获得多少 parallelism。
  • Steady-state throughput:大量 concurrent requests 稳定到达时,array 的总 bandwidth,通常更能体现 RAID 的吞吐上限。

例如 RAID-0 的单 block read latency 与单个 disk 大致相同,因为请求只被转发给一个 disk;但在大量 sequential 或 random requests 下,多个 disks 可以同时工作,吞吐分别接近 N × S 与 N × R。RAID-4/5 的 single read latency 也接近单 disk,small write 则因为 parity 更新通常约为 2T。

RAID-1 的一些表面性能数字还取决于实现:两个 mirror copy 的 read 可以择一,多个 read 也可以分散;write 必须等待两份 copy 都完成,且 positioning time 受到两个 seek 中较慢者影响。顺序 I/O 的简单实现可能只有约一半 bandwidth,但更聪明地把大请求分布到不同 mirror 区域后,实际结果可能更好。

RAID simulation 与学习检查

原文提供 raid.py simulator,用于把 mapping 和 physical I/O pattern 具体化。建议按以下顺序验证:

  1. 比较 RAID-0、1、4、5 的 logical-to-physical mapping,并观察 RAID-5 的 left-symmetric 与 left-asymmetric layout。
  2. 改变 chunk size,检查同一个 logical request 如何变成不同的 disk 请求。
  3. 增大 request size,比较 RAID-4/5 在 small write 与 full-stripe write 下的 physical I/O 数量。
  4. 在 4 个及更多 disks 上分别测量 random read、random write 与 sequential workload,观察 capacity、parity 与 disk 数量对 throughput 的影响。

这些实验的目的不是记住某一组绝对数字,而是验证一个核心规律:parity RAID 的 small-write penalty 会在 full-stripe request 中显著减弱,而 RAID-5 的 rotating parity 主要改善的是多个独立 small writes 之间的并行度。

RAID 的选择可以概括为:只追求性能且数据可丢失时选择 striping;重视 random I/O 与可靠性时 mirroring 很直接;重视 capacity 与单盘容错时 parity RAID 更节省空间,但必须接受 small-write penalty。大规模 array 还要考虑 RAID-6、多 disk failure、hot spare、latent sector error 以及 software RAID 的 consistent-update 问题。

官方 Simulation Homework:raid.py

原文提供 raid.py,用于把 RAID level、chunk size、request size 和 workload 对 physical I/O pattern 的影响具体化。具体命令行选项以 simulator 的 README 为准:

  1. 对 RAID-0、RAID-1、RAID-4、RAID-5 运行基本 mapping tests,推导一组 requests 的 logical-to-physical 映射;对 RAID-5 比较 left-symmetric 与 left-asymmetric layout,并改变 random seed。
  2. 使用 -C 改变 chunk size,重复 mapping,说明 chunk 如何改变一个 logical request 涉及的 disks 和 offsets。
  3. 加入 -r reverse flag,观察 simulator 如何反转每个问题的 request pattern 或布局。
  4. 在 reverse workload 下用 -S 增大 request size,至少测试 8 KB、12 KB、16 KB,并比较不同 RAID levels 的 physical I/O pattern;对 -W sequential 也重复实验,判断 RAID-4/5 在什么 request size 下更高效。
  5. 使用 timing mode(-t),在 4 个 disks 上测量 100 个 random reads,比较 RAID levels。
  6. 增加 disks 数量,观察不同 RAID levels 的 random-read performance 如何 scaling。
  7. 将 workload 改为全 writes(例如 -w 100),比较各 RAID level 随 disks 数量增加的表现,并粗略估算 100 个 random writes 的完成时间。
  8. 使用 -W sequential 测量 sequential workload,比较不同 RAID level、read/write 和 request size;特别判断 RAID-4/5 应采用多大的 write 才能减少 small-write penalty。

实验时应同时记录 capacity、logical request 数、physical I/O 数、read/write amplification、单请求 latency 与 steady-state throughput。不要把 simulator 的简化时间模型直接当成某一款真实 controller 的性能承诺;它的价值在于验证映射和 trade-off。

与已有笔记的关系

参考资料

原文逐段补充(Version 1.10)

本章 CRUX:如何在 disk 上存储和访问 data

上一章介绍了单个 HDD 的 interface 与性能;本章讨论如何组合多个 disks,得到更大、更快或更可靠的 logical block device。RAID 的关键不是只增加 disk 数量,而是同时处理 capacity、reliability、performance 三个彼此牵制的目标。

RAID 对上层保持 transparency:host OS 与 application 仍然看到一组从 0 到 n-1 的 logical blocks,因此管理员可以用 RAID array 替换原来的 disk,而不用重写上层 software。hardware RAID 本身通常是一个小型 computer,包含运行 firmware 的 microcontroller、volatile DRAM buffer,有时还有 battery-backed/non-volatile RAM 和 parity calculation logic。

RAID fault model

本章暂时采用简单的 fail-stop model:一个 disk 要么 working,要么完全 failed;controller/hardware 能立即发现 failure,failed disk 上的 data 不再可读。这里暂不考虑 silent corruption、单个 sector 变得不可访问的 latent sector error 等更复杂、也更现实的 fault;这些属于后续 data integrity 讨论。

Figure 38.1–38.2:RAID-0 与 RAID mapping

Figure 38.1 的 stripe 是同一行中的 blocks;4-disk、chunk size 为一个 block 时,logical block A 的 mapping 是:

text
Disk   = A % number_of_disks
Offset = A / number_of_disks    // integer division

例如 A = 14、disk 数为 4 时,目标是 disk 2 的 offset 3。当 chunk size 为两个 4 KB blocks 时,一个 stripe 包含 4 × 8 KB = 32 KB,需要先计算 chunk number,再计算 chunk 内 offset。

小 chunk 会让一个 file 跨越更多 disks,增加单文件的 intra-file parallelism;但一次请求的 positioning time 取决于参与 disks 中最慢的那个。大 chunk 会减少单文件 parallelism,却可能让一个 file 落在单个 disk 上,只承担一个 disk 的 positioning cost;此时需要多个 concurrent requests 才能获得高吞吐。教材因此指出,最佳 chunk size 取决于 workload;现实 array 常用大于一个 block 的 chunk,例如 64 KB。

RAID 性能分析的 workload 与指标

需要区分:

  • Single-request latency:一个 logical I/O 完成所需的时间,体现一次请求内部有多少 parallelism;
  • Steady-state throughput:大量 concurrent requests 下的总 bandwidth,通常是高性能 RAID 更关心的指标。

本章简化为两类 workload:sequential 是从 block x 开始连续访问大块 data;random 是每个 request 很小且落在不同的随机位置。sequential 时主要时间花在 transfer,random 时主要时间花在 seek 与 rotation。若单 disk 的 sequential bandwidth 为 S、random bandwidth 为 R,通常 S ≫ R。

一个具体估算:平均 seek 7 ms、平均 rotation 3 ms、transfer rate 50 MB/s 时,读取 10 MB 的 sequential request 需要 7 + 3 + 200 = 210 ms,所以 S ≈ 47.62 MB/s;读取 10 KB 的 random request 需要 7 + 3 + 0.195 = 10.195 ms,所以 R ≈ 0.981 MB/s,二者相差接近 50×。

RAID-0 的性能上界

RAID-0 没有 redundancy,因此严格说它并不是“redundant array”,但它提供了 capacity 与 performance 的上界:

  • usable capacity:N × B;
  • 单 block request latency:约等于单 disk,因为只转发给一个 disk;
  • 大量 sequential requests:约 N × S;
  • 大量 random requests:约 N × R。

Figure 38.3:RAID-1、RAID-10 与 consistent update

典型 RAID-1 将每个 logical block 保留两份,并把 copies 放在不同 disks 上。Figure 38.3 中 disk 0/1 是一对 mirror,disk 2/3 是另一对,mirror pairs 之上还做 striping;这种布局通常叫 RAID-10(1+0)。另一种是 RAID-01(0+1):先组成两个 RAID-0 stripe,再对两个 stripe 做 mirror。二者在多 disk failure 下的容错行为不同,不应只把名字当作同义词。

read 可以选择任一 copy;write 必须更新两份,但两次 physical write 可以并行。RAID-1 的容量为 (N × B) / 2,一定能容忍任意一个 disk failure;如果刚好是不同 mirror pair 各坏一块,甚至可能承受更多 failure,但工程设计通常不把这种“取决于位置的幸运”当作保证。

CRUX:RAID consistent-update problem

当一次 logical write 必须更新多个 disks 时,如果 crash/power loss 发生在其中部分 physical writes 完成之后,如何保证 array 中的 copies 或 parity 不会互相矛盾?

例如 RAID-1 先把新 block 写入 disk 0,随后在写 disk 1 前断电;结果 disk 0 是新版本,disk 1 仍是旧版本。理想语义是两个 disks 的状态像一个 atomic operation 一样,要么都变新,要么都保持旧。

通常的解决方法是先写 write-ahead log,记录即将执行的 multi-disk update;crash recovery 时 replay 所有 pending transactions,使 copies 回到一致状态。每次都把 log 写到 disk 代价太高,所以许多 RAID hardware 使用 battery-backed 或其他 non-volatile RAM 保存这类日志。它能降低日志成本,但仍要配合正确的 flush、ordering 与 durability 语义。

RAID-1 的 single read latency 约等于单 disk;write 要等待两个 physical writes 都完成,因此 latency 由两者中较慢的 seek/rotation 决定,平均会略高于单 disk。sequential write 的 steady-state throughput 约为 (N/2) × S;sequential read 也不必然达到 N × S,因为连续 blocks 的 copies 可能集中在同一 mirror pair,简单实现通常约为一半 bandwidth。

RAID-4/5 的 parity 与 small-write penalty

RAID-4 将 parity 集中在一个 parity disk,所有 small writes 都需要更新它,容易形成 bottleneck。RAID-5 在各 disks 间 rotating parity,因此不同 stripes 的 small writes 可以分散,但仍需做 parity update。

对于一个 data block 的 small write,read-modify-write 只需读取 old data 与 old parity:

text
P_new = (D_old XOR D_new) XOR P_old

随后写入 new data 和 new parity,总共两次 read、两次 write。另一种 reconstruct-write 读取 stripe 中其余所有 data blocks,再重新计算 parity;它的读取量会随 data disk 数量增长。full-stripe write 则可以直接对整组新 data 做 XOR,并行写入 data 与 parity,因而显著减轻 penalty。

RAID-5 的 layout 与 reliability

rotating parity 使 parity 不再固定在一个 disk 上,改善了并行度和 parity bottleneck,但不改变单个 small write 的基本 read-modify-write 成本。单一 disk failure 时,可以从同一 stripe 的其余 data 与 parity 重建缺失 block;在 degraded mode 中,位于 failed disk 的 read 会变成 reconstruct read,额外消耗 surviving disks。

rebuild 要扫描大量 surviving blocks 并写入 replacement disk。期间用户 I/O 性能下降,剩余 disks 承受额外负载;若 rebuild 完成前再发生超出 redundancy 能力的 failure,可能导致 data loss。hot spare 可以减少等待 replacement 的时间,却不能消除 rebuild window,也不能解决 latent sector error 或 silent corruption。

Figure 38.4–38.7:parity layout、full-stripe write 与 rotating parity

官方 Figure 38.4 的五盘 RAID-4 布局如下;每个 stripe 的最后一个 block 是集中在 Disk 4 上的 parity:

stripeDisk 0Disk 1Disk 2Disk 3Disk 4
00123P0
14567P1
2891011P2
312131415P3

Figure 38.5 以完整的 0, 1, 2, 3 stripe write 为例:controller 先计算 P0 = XOR(0, 1, 2, 3),再把四个 data blocks 与 parity block 并行写入五个 disks。这是 RAID-4 最有效的写入路径。

Figure 38.6 展示两个同时到达的 small writes:block 4 位于 Disk 0、block 13 位于 Disk 1;它们分别需要读取并更新 parity blocks P1 和 P3。data disks 的操作可以并行,但两个 parity 操作都集中在 Disk 4,因而所有 small writes 会在 parity disk 上串行化。

Figure 38.7 将 parity 在五个 disks 间 rotating:

stripeDisk 0Disk 1Disk 2Disk 3Disk 4
00123P0
1567P14
21011P289
315P3121314
4P416171819

rotating parity 消除了 RAID-4 的固定 parity-disk bottleneck。它不会消除每个 small write 的四次 physical I/O,但多个不同 stripe 的 writes 可以分散到不同 disks 上并行执行。

Figure 38.8:RAID capacity、reliability 与 performance 对照

下面保留官方简化模型的全部主要指标;N 是 disks 数量,B 是每个 disk 的 blocks 数量,S 是单 disk sequential bandwidth,R 是单 disk random bandwidth,T 是单 disk request latency。

metricRAID-0RAID-1RAID-4RAID-5
CapacityN × B(N × B) / 2(N − 1) × B(N − 1) × B
Reliability01(必然);最多 N/2(取决于坏盘位置)11
Sequential readN × S(N/2) × S(N − 1) × S(N − 1) × S
Sequential writeN × S(N/2) × S(N − 1) × S(N − 1) × S
Random readN × RN × R(N − 1) × RN × R
Random writeN × R(N/2) × R(R/2)(N/4) × R
Read latencyTTTT
Write latencyTT2T2T

这是用于理解 trade-off 的简化表,不是具体 controller 的性能保证。镜像写入的实际 latency 受两个 physical writes 中较慢者影响;parity 更新的第一次读取通常承担完整 seek 与 rotation,而随后写 parity 可能只需等待 rotation。官方脚注还特别指出,RAID-1 的 1/2 sequential penalty 假定了朴素的读写方式;如果将 large I/O 分散到 mirror 的不同区域,聪明的实现可能接近 full bandwidth。

38.9 Other Interesting RAID Issues

原文还明确列出后续值得研究的方向:RAID-2/3 等早期 level、RAID-6 的 double-disk-failure tolerance、hot spare、failure/reconstruction 期间的 performance、latent sector error 与 block corruption 等更现实的 fault model,以及 software RAID 的 consistent-update problem。它们说明 RAID level 的选择不能只看一张 capacity/throughput 表,还要把 rebuild window、failure domain、data integrity 和实现成本纳入系统设计。

原文 References 补充

  • [B+08] Lakshmi N. Bairavasundaram 等,An Analysis of Data Corruption in the Storage Stack,FAST ’08。
  • [BJ88] D. Bitton、J. Gray,Disk Shadowing,VLDB 1988。
  • [CL95] Peter M. Chen、Edward K. Lee,Striping in a RAID level 5 disk array,SIGMETRICS 1995。
  • [C+04] P. Corbett 等,Row-Diagonal Parity for Double Disk Failure Correction,FAST ’04。
  • [DAA05] Timothy E. Denehy、A. Arpaci-Dusseau、R. Arpaci-Dusseau,Journal-guided Resynchronization for Software RAID,FAST 2005。
  • [HLM94] Dave Hitz、James Lau、Michael Malcolm,File System Design for an NFS File Server Appliance,USENIX Winter 1994(WAFL)。
  • [K86] M. Y. Kim,Synchronized Disk Interleaving,IEEE Transactions on Computers,1986。
  • [K88] F. Kurzweil,Small Disk Arrays – The Emerging Approach to High Performance,COMPCON ’88。
  • [P+88] D. Patterson、G. Gibson、R. Katz,Redundant Arrays of Inexpensive Disks,SIGMOD 1988。
  • [PB86] A. Park、K. Balasubramaniam,Providing Fault Tolerance in Parallel Secondary Storage Systems,1986。
  • [SG86] K. Salem、H. Garcia-Molina,Disk Striping,ICDE 1986。
  • [S84] F. B. Schneider,Byzantine Generals in Action: Implementing Fail-Stop Processors,ACM TOCS,1984。

源文档核验记录

  • 官方源文档:Redundant Arrays of Inexpensive Disks — Version 1.10
  • 核验范围:PDF 共 18 页,正文章节为 38.1 Interface And RAID Internals、38.2 Fault Model、38.3 How To Evaluate A RAID、38.4 RAID Level 0: Striping、38.5 RAID Level 1: Mirroring、38.6 RAID Level 4: Saving Space With Parity、38.7 RAID Level 5: Rotating Parity、38.8 RAID Comparison: A Summary、38.9 Other Interesting RAID Issues、38.10 Summary。
  • 图件核验:Figure 38.1–38.8 均已按原文出现顺序保留语义位置;striping、mirroring、parity、full-stripe write、small-write bottleneck、rotating parity 和 comparison table 使用表格、Mermaid、公式或代码块重绘。官方 PDF 未包含需要另存的独立 raster image,因此没有遗漏图片文件或可调整的原图尺寸。
  • 练习核验:raid.py Simulation Homework 的 8 个问题均已翻译,保留 RAID level、-C、-r、-S、-t、-w 100、-W sequential 等原始实验参数。
← 返回列表
← 上一篇 OSTEP:Hard Disk Drives 下一篇 → OSTEP:Files and Directories

评论 (0)

暂无评论,来留下第一条吧。
登录 或 注册 后才能发表评论