5.4.16. RAID 論理ボリューム
Red Hat Enterprise Linux 6.3 リリースでは、LVM は RAID4/5/6 およびミラーリングの新実装をサポートしています。最新のミラーリングの実装と以前のミラーリングの実装 (「ミラー化ボリュームの作成」 で説明) が異なる点は以下のとおりです。
- ミラーリングの新実装でのセグメントタイプは
raid1です。以前の実装でのセグメントタイプはmirrorです。 - RAID 4/5/6 実装のように、ミラーリングの新実装は MD ソフトウェア RAID を活用します。
- ミラーリングの新実装は、各ミラーイメージの完全な冗長性を備えたビットマップ領域を管理することで、そのフォルト処理機能を拡大します。これは、このセグメントタイプで作成されるミラーには
--mirrorlogや--corelogオプションはないことを意味しています。 - ミラーリングの新実装は、一時的な障害を処理することができます。
- ミラーイメージはアレイから一時的に離して、後ほどそれとマージしなおすことができます。
- ミラーリングの新実装はスナップショットをサポートします (レベルの高い RAID の新実装も同様)。
- RAID の新実装はクラスター対応ではありません。クラスター化ボリュームグループ内で LVM RAID 論理ボリュームを作成することはできません。
For information on how failures are handled by the RAID logical volumes, see 「RAID フォルトポリシーの設定」.
このセクションの残りでは、LVM RAID デバイスで実行できる以下の管理タスクについて説明しています。
5.4.16.1. RAID 論理ボリュームの作成 リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
RAID 論理ボリュームを作成するには、
lvcreate コマンドの --type 引数として raid タイプを指定します。通常、lvcreate コマンドを使用して論理ボリュームを作成する場合、--type 引数は暗黙的です。例えば、-i stripes 引数を指定する場合、lvcreate コマンドは --type stripe オプションを想定します。-m mirrors 引数を指定する場合は、lvcreate コマンドは --type mirror オプションを想定します。ただし、RAID 論理ボリュームを作成する場合は、任意のセグメントタイプを明示的に指定する必要があります。可能な RAID のセグメントタイプは 表5.1「RAID のセグメントタイプ」 に記載されています。
| セグメントタイプ | 説明 | ||
|---|---|---|---|
raid1 | RAID1 ミラーリング | ||
raid4 | RAID4 専用のパリティディスク | ||
raid5 | raid5_ls と同様 | ||
raid5_la |
| ||
raid5_ra |
| ||
raid5_ls |
| ||
raid5_rs |
| ||
raid6 | raid6_zr と同様 | ||
raid6_zr |
| ||
raid6_nr |
| ||
raid6_nc |
| ||
raid10 (Red Hat Enterprise Linux 6.4 以降) |
|
For most users, specifying one of the five available primary types (
raid1, raid4, raid5, raid6, raid10) should be sufficient. For more information on the different algorithms used by RAID 5/6, see chapter four of the 『Common RAID Disk Data Format Specification』 at http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf.
RAID 論理ボリュームを作成する場合、LVM は、各データまたはアレイ内のパリティサブボリュームごとに、サイズが 1 エクステントのメタデータサブボリュームを作成します。例えば、2 方向の RAID1 アレイを作成すると、2 つのメタデータサブボリューム (
lv_rmeta_0 および lv_rmeta_1) と 2 つのデータサブボリューム (lv_rimage_0 および lv_rimage_1) が生じます。同様に、3 方向のストライプ (プラス、1 つの暗黙的なパリティデバイス) RAID4 を作成すると、4 つのメタデータサブボリューム (lv_rmeta_0、lv_rmeta_1、lv_rmeta_2、および lv_rmeta_3) と 4 つのデータサブボリューム (lv_rimage_0、lv_rimage_1、lv_rimage_2、および lv_rimage_3) が生じます。
以下のコマンドは、ボリュームグループ
my_vg 内にサイズが 1G の my_lv と呼ばれる 2 方向の RAID1 アレイを作成します。
lvcreate --type raid1 -m 1 -L 1G -n my_lv my_vg
# lvcreate --type raid1 -m 1 -L 1G -n my_lv my_vg
-m 引数に指定する値に沿って、異なる数のコピーで RAID1 アレイを作成することができます。-m 引数は、以前のミラー実装用のコピー数を指定するために使用される同じ引数ですが、この場合はセグメントタイプを raid1 と明示的に指定することで、デフォルトのセグメントタイプ mirror を上書きします。同様に、-i argument を使用して RAID 4/5/6 論理ボリュームのストライプ数を指定して、デフォルトのセグメントタイプを任意の RAID タイプで上書きします。また、ストライプサイズも -I 引数で指定できます。
注記
デフォルトのミラーセグメントタイプを
raid1 にセットするには、lvm.conf ファイルの mirror_segtype_default を変更します。
以下のコマンドは、ボリュームグループ
my_vg 内のサイズが 1G の my_lv と呼ばれる RAID5 アレイ (3 つのストライプ + 1 つの暗黙的なパリティドライブ) を作成します。ストライプ数の指定は、LVM ストライプ化ボリュームに対して指定するのと同じように行います。パリティドライブの正確な数は自動的に追加されます。
lvcreate --type raid5 -i 3 -L 1G -n my_lv my_vg
# lvcreate --type raid5 -i 3 -L 1G -n my_lv my_vg
以下のコマンドは、ボリュームグループ
my_vg 内にサイズが 1G の my_lv と呼ばれる RAID6 アレイ (3 つのストライプ + 2 つの暗黙的なパリティドライブ) を作成します。
lvcreate --type raid6 -i 3 -L 1G -n my_lv my_vg
# lvcreate --type raid6 -i 3 -L 1G -n my_lv my_vg
LVM によって RAID 論理ボリュームを作成した後には、ボリュームのアクティブ化、変更、削除、表示、使用を他の LVM 論理ボリュームと同じように行うことができます。
When you create RAID10 logical volumes, the background I/O required to initialize the logical volumes with a
sync operation can crowd out other I/O operations to LVM devices, such as updates to volume group metadata, particularly when you are creating many RAID logical volumes. This can cause the other LVM operations to slow down.
As of Red Hat Enterprise Linux 6.5, you can control the rate at which a RAID logical volume is initialized by implementing recovery throttling. You control the rate at which
sync operations are performed by setting the minimum and maximum I/O rate for those operations with the --minrecoveryrate and --maxrecoveryrate options of the lvcreate command. You specify these options as follows.
--maxrecoveryrate Rate[bBsSkKmMgG]Sets the maximum recovery rate for a RAID logical volume so that it will not crowd out nominal I/O operations. The Rate is specified as an amount per second for each device in the array. If no suffix is given, then kiB/sec/device is assumed. Setting the recovery rate to 0 means it will be unbounded.--minrecoveryrate Rate[bBsSkKmMgG]Sets the minimum recovery rate for a RAID logical volume to ensure that I/O forsyncoperations achieves a minimum throughput, even when heavy nominal I/O is present. The Rate is specified as an amount per second for each device in the array. If no suffix is given, then kiB/sec/device is assumed.
The following command creates a 2-way RAID10 array with 3 stripes that is 10G is size with a maximum recovery rate of 128 kiB/sec/device. The array is named
my_lv and is in the volume group my_vg.
lvcreate --type raid10 -i 2 -m 1 -L 10G --maxrecoveryrate 128 -n my_lv my_vg
lvcreate --type raid10 -i 2 -m 1 -L 10G --maxrecoveryrate 128 -n my_lv my_vg
You can also specify minimum and maximum recovery rates for a RAID scrubbing operation. For information on RAID scrubbing, see 「Scrubbing a RAID Logical Volume」.