5.4.4. シンプロビジョニングされた論理ボリュームの作成
As of the Red Hat Enterprise Linux 6.4 release, logical volumes can be thinly provisioned. This allows you to create logical volumes that are larger than the available extents. Using thin provisioning, you can manage a storage pool of free space, known as a thin pool, which can be allocated to an arbitrary number of devices when needed by applications. You can then create devices that can be bound to the thin pool for later allocation when an application actually writes to the logical volume. The thin pool can be expanded dynamically when needed for cost-effective allocation of storage space.
注記
This section provides an overview of the basic commands you use to create and grow thinly-provisioned logical volumes. For detailed information on LVM thin provisioning as well as information on using the LVM commands and utilities with thinly-provisioned logical volumes, see the
lvmthin(7) man page.
注記
シンボリュームはクラスターのノード間ではサポートされません。シンプールとそのすべてのシンボリュームは、1 つのクラスターノードでのみ排他的にアクティブ化する必要があります。
シンプロビジョニングされたボリュームを作成するには、以下のタスクを実行してください。
vgcreateコマンドを使用して、ボリュームグループを作成します。lvcreateコマンドを使用して、シンプールを作成します。lvcreateコマンドを使用して、シンプール内にシンプロビジョニングされたボリュームを作成します。
lvcreate コマンドに -T (または --thin) オプションを使用して、シンプールまたはシンプロビジョニングされたボリュームを作成します。また、lvcreate コマンドの -T オプションを使用して、1 つのコマンドで同時にプール内にシンプールとシンプロビジョニングされたボリュームの両方を作成することも可能です。
以下のコマンドは、
lvcreate コマンドに -T オプションを使用して、mythinpool と呼ばれるシンプールを作成します。これは、ボリュームグループ vg001 内にあり、サイズは 100M です。物理領域のプールを作成しているため、プールのサイズを指定する必要があります。lvcreate コマンドの -T オプションは引数を取りません。コマンドが指定する他のオプションから作成されるデバイスのタイプを推定します。
以下のコマンドは、
lvcreate コマンドに -T オプションを使用して、シンプール vg001/mythinpool に thinvolume と呼ばれるシンプロビジョニングされたボリュームを作成します。ここでは、仮想サイズを指定して、ボリュームを含むプールよりも大きなボリュームの仮想サイズを指定している点に注意してください。
以下のコマンドは、
lvcreate コマンドに -T オプションを使用して、プール内にシンプールとシンプロビジョニングされたボリュームを作成します。その際、lvcreate コマンドでサイズと仮想サイズの引数を指定します。また、このコマンドは、ボリュームグループ vg001 内に mythinpool と呼ばれるシンプールを作成し、そのプール内に thinvolume と呼ばれるシンプロビジョニングされたボリュームも作成します。
また、
lvcreate コマンドの --thinpool パラメーターを指定して、シンプールを作成することも可能です。-T オプションとは異なり、--thinpool パラメーターには作成しているシンプール論理ボリューム名の引数が必要です。以下の例は、lvcreate コマンドで --thinpool パラメーターを指定して、mythinpool と呼ばれるシンプールを作成します。これは、ボリュームグループ vg001 内にあり、サイズは 100M です。
プール作成用に、ストライピングはサポートされています。以下のコマンドは、2 つの 64 kB のストライプと 256 kB のチャンクサイズがあるボリュームグループ
vg001 内に pool と呼ばれる 100M のシンプールを作成します。また、1T のシンプロビジョニングされたボリューム vg00/thin_lv も作成します。
lvcreate -i 2 -I 64 -c 256 -L100M -T vg00/pool -V 1T --name thin_lv
# lvcreate -i 2 -I 64 -c 256 -L100M -T vg00/pool -V 1T --name thin_lv
lvextend コマンドを使用してシンプロビジョニングされたボリュームのサイズを拡張できます。ただし、シンプールのサイズを縮小することはできません。
以下のコマンドは、既存のシンプールのサイズ (100M) を変更し、100M 拡張します。
他の論理ボリュームのタイプと同様に、
lvrename を使用してボリューム名の変更、lvremove を使用してボリュームの削除、lvs と lvdisplay のコマンドを使用してボリュームの情報の表示を行うことができます。
By default, the
lvcreate command sets the size of the thin pool's metadata logical volume according to the formula (Pool_LV_size / Pool_LV_chunk_size * 64). You cannot currently resize the metadata volume, however, so if you expect significant growth of the size of thin pool at a later time you should increase this value with the --poolmetadatasize parameter of the lvcreate command. The supported value for the thin pool's metadata logical volume is in the range between 2MiB and 16GiB.
You can use the
--thinpool parameter of the lvconvert command to convert an existing logical volume to a thin pool volume. When you convert an existing logical volume to a thin pool volume, you must use the --poolmetadata parameter in conjunction with the --thinpool parameter of the lvconvert to convert an existing logical volume to the thin pool volume's metadata volume.
注記
Converting a logical volume to a thin pool volume or a thin pool metadata volume destroys the content of the logical volume, since in this case the
lvconvert does not preserve the content of the devices but instead overwrites the content.
The following example converts the existing logical volume
lv1 in volume group vg001 to a thin pool volume and converts the existing logical volume lv2 in volume group vg001 to the metadata volume for that thin pool volume.
lvconvert --thinpool vg001/lv1 --poolmetadata vg001/lv2
# lvconvert --thinpool vg001/lv1 --poolmetadata vg001/lv2
Converted vg001/lv1 to thin pool.