Red Hat Training
A Red Hat training course is available for RHEL 8
11.3. 論理ボリュームの dm-cache キャッシュの有効化
この手順では、dm-cache
メソッドを使用して、論理ボリュームで一般的に使用されるデータのキャッシュを有効にします。
前提条件
-
システムに、
dm-cache
を使用した高速化したい低速な論理ボリュームがある。 - 低速な論理ボリュームを含むボリュームグループには、高速ブロックデバイスに未使用の物理ボリュームも含まれます。
手順
高速デバイスに
cachevol
ボリュームを作成します。# lvcreate --size cachevol-size --name <fastvol> <vg> </dev/fast-pv>
以下の値を置き換えます。
cachevol-size
-
5G
などのcachevol
ボリュームのサイズ fastvol
-
cachevol
ボリュームの名前 vg
- ボリュームグループ名
/dev/fast-pv
高速ブロックデバイスへのパス (例:
/dev/sdf1
)例11.1
cachevol
ボリュームの作成# lvcreate --size 5G --name fastvol vg /dev/sdf Logical volume "fastvol" created.
cachevol
ボリュームをメインの論理ボリュームに接続して、キャッシュを開始します。# lvconvert --type cache --cachevol <fastvol> <vg/main-lv>
以下の値を置き換えます。
fastvol
-
cachevol
ボリュームの名前 vg
- ボリュームグループ名
main-lv
低速な論理ボリュームの名前
例11.2
cachevol
ボリュームのメイン LV への割り当て# lvconvert --type cache --cachevol fastvol vg/main-lv Erase all existing data on vg/fastvol? [y/n]: y Logical volume vg/main-lv is now cached.
検証手順
新規作成した論理ボリュームで
dm-cache
が有効になっているかどうかを確認します。# lvs --all --options +devices <vg> LV Pool Type Devices main-lv [fastvol_cvol] cache main-lv_corig(0) [fastvol_cvol] linear /dev/fast-pv [main-lv_corig] linear /dev/slow-pv
関連情報
-
lvmcache(7)
man ページ