【2024年01月版】要点だけ覚える初心者向け RAID メモ【RAID0, RAID1, RAID5, RAID6, RAID10, RAID50, RAID60】

# はじめに

これは、すぐにわすれてしまう RAID の構成の、解説と図解の記事。初心者向け。

RAIDの、構成は、以下を覚えておく。

- ストライピング
- ミラーリング
- パリティ

上記の組み合わせを覚える。この記事では以下を扱う。

| RAID | 構成 |
|:-:|:-:|
| [RAID 0](#raid-0)  | ストライピング  |
| [RAID 1](#raid-1)  | ミラーリング  |
| [RAID 5](#raid-5)  | パリティ  |
| [RAID 6](#raid-6)  | ダブルパリティ  |
| [RAID 10](#raid-10)  | ストライピング　＋　ミラーリング  |
| [RAID 50](#raid-50)  | ストライピング　＋　パリティ  |
| [RAID 60](#raid-60)  | ストライピング　＋　ダブルパリティ  |

RAIDの、速度と対障害性は、以下を覚えておく。

- 速度  
RAID 0 > RAID 10 ≈ RAID 50 ≈ RAID 60 > RAID 5 > RAID 6 > RAID 1

- 対障害性  
RAID 60 > RAID 50 > RAID 6 > RAID 10 > RAID 5 > RAID 1 > RAID 0

以下に、それぞれのRAIDの解説を続ける。

:::note info
時間ができたら各構成毎にLinux上でソフトウェアRAIDを構築する記事を[リンク](#参考リンク)する。
:::

:::note info
耐障害性について、RAID 5でいいのでは？と思うことがある。が、経験上同時に購入したディスクはほぼ同時期に逝ったりする。で、1台逝ってパリティでセーフと思っていたら、不良セクタで回復できない、とかまであった。
:::

# RAID 0
　ストライピング
 
- 必要なディスク数  
最低2台
- メリット  
高速な読み書き性能で、データが複数のディスクに分散されるため、同時にアクセスが可能
- デメリット  
冗長性がなく、1台のディスクが故障すると全てのデータが失われる
- 対障害性  
RAID 60 > RAID 50 > RAID 6 > RAID 10 > RAID 5 > RAID 1 > <font color="#ffaa44">**RAID 0(なし)**</font>
- 速度  
<font color="#ffaa44">**RAID 0**</font> > RAID 10 ≈ RAID 50 ≈ RAID 60 > RAID 5 > RAID 6 > RAID 1

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
interface "Data 0" as D0
interface "Data 1" as D1
interface "Data 2" as D2
interface "Data 3" as D3
interface "Data 4" as D4
interface "Data 5" as D5
interface "Data 6" as D6
interface "Data 7" as D7
interface "Data 8" as D8
interface "Data 9" as D9
}

node "Raid Controller" as RC

rectangle "HDD 1" as HDD1 {
interface "Data 0" as S0
interface "Data 2" as S2
interface "Data 4" as S4
interface "Data 6" as S6
interface "Data 8" as S8
}

rectangle "HDD 2" as HDD2 {
interface "Data 1" as S1
interface "Data 3" as S3
interface "Data 5" as S5
interface "Data 7" as S7
interface "Data 9" as S9
}

DB -[hidden]-- WP
WP --> RC
RC ---> HDD1 : striping
RC ---> HDD2 : striping

@enduml
```

# RAID 1

ミラーリング

- 必要なディスク数  
最低2台
- メリット  
ミラーリングにより高いデータ冗長性
- デメリット  
ストレージ容量の半分が冗長性のために使用される
- 対障害性  
RAID 60 > RAID 50 > RAID 6 > RAID 10 > RAID 5 > <font color="#ffaa44">**RAID 1（1台のディスクが故障してもデータは安全）**</font> > RAID 0</font>
- 速度  
RAID 0 > RAID 10 ≈ RAID 50 ≈ RAID 60 > RAID 5 > RAID 6 > <font color="#ffaa44">**RAID 1(読み込みは高速だが、書き込みは通常の速度)**</font>

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
    interface "Data 0" as D0
    interface "Data 1" as D1
    interface "Data 2" as D2
    interface "Data 3" as D3
    interface "Data 4" as D4
    interface "Data 5" as D5
    interface "Data 6" as D6
    interface "Data 7" as D7
    interface "Data 8" as D8
    interface "Data 9" as D9
}

node "Raid Controller" as RC

rectangle "HDD 1" as HDD1 {
    interface "Data 0" as S0
    interface "Data 1" as S1
    interface "Data 2" as S2
    interface "Data 3" as S3
    interface "Data 4" as S4
    interface "Data 5" as S5
    interface "Data 6" as S6
    interface "Data 7" as S7
    interface "Data 8" as S8
    interface "Data 9" as S9
}

rectangle "HDD 2" as HDD2 {
    interface "Data 0" as S0_2 #yellow
    interface "Data 1" as S1_2 #yellow
    interface "Data 2" as S2_2 #yellow
    interface "Data 3" as S3_2 #yellow
    interface "Data 4" as S4_2 #yellow
    interface "Data 5" as S5_2 #yellow
    interface "Data 6" as S6_2 #yellow
    interface "Data 7" as S7_2 #yellow
    interface "Data 8" as S8_2 #yellow
    interface "Data 9" as S9_2 #yellow
}

DB -[hidden]-- WP
WP --> RC
RC ---> HDD1 : mirroring
RC ---> HDD2 : mirroring

@enduml
```

# RAID 5

パリティ

- 必要なディスク数  
最低3台
- メリット  
ストライピングとパリティ（誤り訂正情報）により、1台のディスクが故障してもデータは保護される
- デメリット  
書き込み時のパリティ計算によるオーバーヘッドがある
- 対障害性  
RAID 60 > RAID 50 > RAID 6 > RAID 10 > <font color="#ffaa44">**RAID 5(1台のディスク故障まで許容)**</font> > RAID 1 > RAID 0</font>
- 速度  
RAID 0 > RAID 10 ≈ RAID 50 ≈ RAID 60 > <font color="#ffaa44">**RAID 5(読み込みは高速、書き込みはやや遅い)**</font> > RAID 6 > RAID 1

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
    interface "Data 0" as D0
    interface "Data 1" as D1
    interface "Data 2" as D2
    interface "Data 3" as D3
    interface "Data 4" as D4
    interface "Data 5" as D5
    interface "Data 6" as D6
    interface "Data 7" as D7
    interface "Data 8" as D8
}

node "Raid Controller" as RC

rectangle "HDD 1" as HDD1 {
    interface "Data 0" as S0
    interface "Data 3" as S3
    interface "Data 6" as S6
    interface "Parity for D1, D2" as P12 #yellow
    interface "Parity for D4, D5" as P45 #yellow
    interface "Parity for D7, D8" as P78 #yellow
}

rectangle "HDD 2" as HDD2 {
    interface "Data 1" as S1
    interface "Data 4" as S4
    interface "Data 7" as S7
    interface "Parity for D2, D3" as P23 #yellow
    interface "Parity for D5, D6" as P56 #yellow
    interface "Parity for D8, D9" as P89 #yellow
}

rectangle "HDD 3" as HDD3 {
    interface "Data 2" as S2
    interface "Data 5" as S5
    interface "Data 8" as S8
    interface "Parity for D0, D1" as P01 #yellow
    interface "Parity for D3, D4" as P34 #yellow
    interface "Parity for D6, D7" as P67 #yellow
}

DB -[hidden]-- WP
WP --> RC
RC ---> HDD1
RC ---> HDD2
RC ---> HDD3

@enduml
```

# RAID 6

ダブルパリティ

- 必要なディスク数  
最低4台
- メリット  
パリティをダブルで使用し、2台のディスクが同時に故障してもデータは保護され、パリティには、「2D-XOR」と「P+Q」方式がある
- デメリット
ダブルパリティ計算のためのオーバーヘッドがさらに増加
- 対障害性  
RAID 60 > RAID 50 > <font color="#ffaa44">**RAID 6(2台のディスク故障まで許容)**</font> > RAID 10 > RAID 5 > RAID 1 > RAID 0</font>
- 速度  
RAID 0 > RAID 10 ≈ RAID 50 ≈ RAID 60 > RAID 5 > <font color="#ffaa44">**RAID 6(読み込みは高速、書き込みはRAID 5より遅い)**</font> > RAID 1

Linux上で実際の構築を行った記事 → [【2024年01月版】Ubuntu で RAID 6 構築 - 障害復旧 メモ 【中年エンジニアのためのLinuxメモ】](https://qiita.com/nouernet/items/74e68c0b8af82c819167)

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
    interface "Data 0" as D0
    interface "Data 1" as D1
    interface "Data 2" as D2
    interface "Data 3" as D3
    interface "Data 4" as D4
    interface "Data 5" as D5
    interface "Data 6" as D6
    interface "Data 7" as D7
}

node "Raid Controller" as RC

rectangle "HDD 1" as HDD1 {
    interface "Data 0"
    interface "Data 4"
    interface "Parity P" as hd1_p #yellow
    interface "Parity Q" as hd1_q #blue
}

rectangle "HDD 2" as HDD2 {
    interface "Data 1"
    interface "Data 5"
    interface "Parity P" as hd2_p #yellow
    interface "Parity Q" as hd2_1 #blue
}

rectangle "HDD 3" as HDD3 {
    interface "Data 2"
    interface "Data 6"
    interface "Parity P" as hd3_p #yellow
    interface "Parity Q" as hd3_1 #blue
}

rectangle "HDD 4" as HDD4 {
    interface "Data 3"
    interface "Data 7"
    interface "Parity P" as hd4_p #yellow
    interface "Parity Q" as hd4_1 #blue
}

DB -[hidden]-- WP
WP --> RC
RC ---> HDD1
RC ---> HDD2
RC ---> HDD3
RC ---> HDD4

@enduml
```

# RAID 10

ストライピング　＋　ミラーリング

- 必要なディスク数  
最低4台（偶数）
- メリット  
ストライピングとミラーリングを組み合わせた高速性と冗長性
- デメリット  
高コストで、利用可能な総ストレージ容量はディスク総容量の半分
- 対障害性  
RAID 60 > RAID 50 > RAID 6 > <font color="#ffaa44">**RAID 10(1つのミラーセット内で1台のディスクが故障しても安全)**</font> > RAID 5 > RAID 1 > RAID 0</font>
- 速度  
RAID 0 > <font color="#ffaa44">**RAID 10**</font> ≈ RAID 50 ≈ RAID 60 > RAID 5 > RAID 6 > RAID 1

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
    interface "Data 0" as D0
    interface "Data 1" as D1
    interface "Data 2" as D2
    interface "Data 3" as D3
    interface "Data 4" as D4
    interface "Data 5" as D5
    interface "Data 6" as D6
    interface "Data 7" as D7
    interface "Data 8" as D8
    interface "Data 9" as D9
}

node "Raid Controller" as RC

rectangle "GROUP 0" as G0 {
rectangle "HDD 1" as HDD1 {
    interface "Data 0" as S0
    interface "Data 2" as S2
    interface "Data 4" as S4
    interface "Data 6" as S6
    interface "Data 8" as S8
}

rectangle "HDD 2" as HDD2 {
    interface "Data 0" as S0_2 #yellow
    interface "Data 2" as S2_2 #yellow
    interface "Data 4" as S4_2 #yellow
    interface "Data 6" as S6_2 #yellow
    interface "Data 8" as S8_2 #yellow
}
}

rectangle "GROUP 1" as G1 {
rectangle "HDD 3" as HDD3 {
    interface "Data 1" as S1
    interface "Data 3" as S3
    interface "Data 5" as S5
    interface "Data 7" as S7
    interface "Data 9" as S9
}

rectangle "HDD 4" as HDD4 {
    interface "Data 1" as S1_2 #yellow
    interface "Data 3" as S3_2 #yellow
    interface "Data 5" as S5_2 #yellow
    interface "Data 7" as S7_2 #yellow
    interface "Data 9" as S9_2 #yellow
}
}

DB -[hidden]-- WP
WP --> RC
RC --> G0 : striping
RC --> G1 : striping

@enduml
```

# RAID 50

ストライピング　＋　パリティ

- 必要なディスク数  
RAID 5のセット × 2以上（最低6台）
- メリット  
RAID 5の冗長性とRAID 0の高速性を組み合わせた構成
- デメリット
複雑な構成と高いコスト
- 対障害性  
RAID 60 > <font color="#ffaa44">**RAID 50(RAID 5よりやや高い)**</font> > RAID 6 > RAID 10 > RAID 5 > RAID 1 > RAID 0</font>
- 速度  
RAID 0 > RAID 10 ≈ <font color="#ffaa44">**RAID 50**</font> ≈ RAID 60 > RAID 5 > RAID 6 > RAID 1

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
    interface "Data 0" as D0
    interface "Data 1" as D1
    interface "Data 2" as D2
    interface "Data 3" as D3
    interface "Data 4" as D4
    interface "Data 5" as D5
    interface "Data 6" as D6
    interface "Data 7" as D7
    interface "Data 8" as D8
    interface "Data 9" as D9
    interface "Data 10" as D10
    interface "Data 11" as D11
}

node "Raid Controller" as RC

rectangle "GROUP 0" as G0 {
    rectangle "HDD 1" as HDD1 {
        interface "Data 0" as S0
        interface "Data 6" as S6
        interface "Parity for D2, D4" #yellow
        interface "Parity for D8, D10" #yellow
    }

    rectangle "HDD 2" as HDD2 {
        interface "Data 2" as S2
        interface "Data 8" as S8
        interface "Parity for D0, D4" #yellow
        interface "Parity for D6, D10" #yellow
    }

    rectangle "HDD 3" as HDD3 {
        interface "Data 4" as S4
        interface "Data 10" as S10
        interface "Parity for D0, D2" #yellow
        interface "Parity for D6, D8" #yellow
    }
    HDD1 -[hidden]- HDD2
    HDD2 -[hidden]- HDD3
}

rectangle "GROUP 1" as G1 {
    rectangle "HDD 4" as HDD4 {
        interface "Data 1" as S1
        interface "Data 7" as S7
        interface "Parity for D3, D5" #yellow
        interface "Parity for D9, D11" #yellow
    }

    rectangle "HDD 5" as HDD5 {
        interface "Data 3" as S3
        interface "Data 9" as S9
        interface "Parity for D1, D5" #yellow
        interface "Parity for D7, D11" #yellow
    }

    rectangle "HDD 6" as HDD6 {
        interface "Data 5" as S5
        interface "Data 11" as S11
        interface "Parity for D1, D3" #yellow
        interface "Parity for D7, D9" #yellow
    }
    HDD4 -[hidden]- HDD5
    HDD5 -[hidden]- HDD6
}

DB -[hidden]-- WP
WP --> RC
RC --> G0 : striping
RC --> G1 : striping

@enduml
```

# RAID 60

ストライピング　＋　ダブルパリティ

- 必要なディスク数  
RAID 6のセット × 2以上（最低8台）
- メリット  
RAID 6の冗長性とRAID 0の高速性を組み合わせた構成
- デメリット  
高コストと複雑な構成
- 対障害性  
<font color="#ffaa44">**RAID 60(RAID 6よりやや高い)**</font> > RAID 50 > RAID 6 > RAID 10 > RAID 5 > RAID 1 > RAID 0</font>
- 速度  
RAID 0 > RAID 10 ≈ RAID 50 ≈ <font color="#ffaa44">**RAID 60**</font> > RAID 5 > RAID 6 > RAID 1

```plantuml
@startuml
left to right direction
node "Write Process" as WP

rectangle "Data Block" as DB {
    interface "Data 0" as D0
    interface "Data 1" as D1
    interface "Data 2" as D2
    interface "Data 3" as D3
    interface "Data 4" as D4
    interface "Data 5" as D5
    interface "Data 6" as D6
    interface "Data 7" as D7
    interface "Data 8" as D8
    interface "Data 9" as D9
}

node "Raid Controller" as RC

rectangle "GROUP 0" as G0 {
rectangle "HDD 1" as HDD1 {
    interface "Data 0"
    interface "Data 8"
    interface "Parity P" as hd1_p #yellow
    interface "Parity Q" as hd1_q #blue
}

rectangle "HDD 2" as HDD2 {
    interface "Data 2"
    interface "Data 10"
    interface "Parity P" as hd2_p #yellow
    interface "Parity Q" as hd2_1 #blue
}

rectangle "HDD 3" as HDD3 {
    interface "Data 4"
    interface "Data 12"
    interface "Parity P" as hd3_p #yellow
    interface "Parity Q" as hd3_1 #blue
}

rectangle "HDD 4" as HDD4 {
    interface "Data 6"
    interface "Data 14"
    interface "Parity P" as hd4_p #yellow
    interface "Parity Q" as hd4_1 #blue
}
}

rectangle "GROUP 1" as G1 {
rectangle "HDD 5" as HDD5 {
    interface "Data 1"
    interface "Data 9"
    interface "Parity P" as hd5_p #yellow
    interface "Parity Q" as hd5_q #blue
}

rectangle "HDD 6" as HDD6 {
    interface "Data 3"
    interface "Data 11"
    interface "Parity P" as hd6_p #yellow
    interface "Parity Q" as hd6_1 #blue
}

rectangle "HDD 7" as HDD7 {
    interface "Data 5"
    interface "Data 13"
    interface "Parity P" as hd7_p #yellow
    interface "Parity Q" as hd7_1 #blue
}

rectangle "HDD 8" as HDD8 {
    interface "Data 7"
    interface "Data 15"
    interface "Parity P" as hd8_p #yellow
    interface "Parity Q" as hd8_1 #blue
}
}

DB -[hidden]-- WP
WP --> RC
RC --> G0 : striping
RC --> G1 : striping

@enduml

```

# さいごに

要点だけだと、かんたんでしたね

# 参考リンク

- [cman WEB便利ノート RAID比較（構成・速度実測・耐障害性）](https://note.cman.jp/server/raid/)
- [cman WEB便利ノート RAIDの容量計算](https://note.cman.jp/server/raid/raidcal/)
- [Synology RAID計算機](https://www.synology.com/ja-jp/support/RAID_calculator)
- [ネットワークエンジニアとして RAID：RAID0 / RAID1 / RAID5 / RAID6 / RAID10](https://www.infraexpert.com/study/networking9.html)
- [【2024年01月版】Ubuntu で RAID 6 構築 - 障害復旧 メモ 【中年エンジニアのためのLinuxメモ】](https://qiita.com/nouernet/items/74e68c0b8af82c819167)