作業ログ源泉垂れ流し

しがないIT技術者の作業ログを垂れ流す

LVMでのシンプロビジョニング論理ボリュームの作成 1

LVMでシンプロビジョニングの論理ボリュームを作ってみる。

まず必要なパッケージがインストールされていない場合はインストールする。
Debianの場合

# apt install thin-provisioning-tools

Red Hatのドキュメントを参考に進める。

空きのあるVG(ここではvg01)に、1 GBのシンプール thinpool を作成する。

# lvcreate -L 1G -T vg01/thinpool
  Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of da
ta.
  Logical volume "thinpool" created.
# lvs
  LV       VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%S
ync Convert   
  root     debian-vg -wi-ao----  <8.36g                                         

  swap_1   debian-vg -wi-ao---- 976.00m                                         

  thinpool vg01      twi-a-tz--   1.00g             0.00   10.94                

続いて、今作ったシンプール vg01/thinpool に、1 GBのシンボリューム thinvolume01 を作成する。

# lvcreate -V 1G -T vg01/thinpool -n thinvolume01
  Logical volume "thinvolume01" created.
# lvs
  LV           VG        Attr       LSize   Pool     Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root         debian-vg -wi-ao----  <8.36g                                                        
  swap_1       debian-vg -wi-ao---- 976.00m                                                        
  thinpool     vg01      twi-aotz--   1.00g                 0.00   11.04                           
  thinvolume01 vg01      Vwi-a-tz--   1.00g thinpool        0.00                                   

同じシンプール vg01/thinpool に、さらに、1 GBのシンボリューム thinvolume02 を作成する。

# lvcreate -V 1G -T vg01/thinpool -n thinvolume02
  WARNING: Sum of all thin volume sizes (2.00 GiB) exceeds the size of thin pool vg01/thinpool and the size of whole volume group (<2.00 GiB).
  WARNING: You have not turned on protection against thin pools running out of space.
  WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
  Logical volume "thinvolume02" created.

シンボリュームの合計サイズが、シンプールのサイズを超えているという警告は出るものの、論理ボリュームは作成された。

論理ボリュームの一覧を確認してみる。

# lvs
  LV           VG        Attr       LSize   Pool     Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root         debian-vg -wi-ao----  <8.36g                                                        
  swap_1       debian-vg -wi-ao---- 976.00m                                                        
  thinpool     vg01      twi-aotz--   1.00g                 0.00   11.13                           
  thinvolume01 vg01      Vwi-a-tz--   1.00g thinpool        0.00                                   
  thinvolume02 vg01      Vwi-a-tz--   1.00g thinpool        0.00                                   

LVMでオーバーコミットした論理ボリュームが作成できた!