0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Linux基礎】LVM構築手順

0
Posted at

はじめに

LVM構築の流れを、イメージで理解します。

LVMとは
「ディスクを仮想化して、あとから自由にサイズ変更できる仕組み」

LVM構築の流れ

image.png

  1. パーティション作成
  2. PV(物理ボリューム)作成
  3. VG(ボリュームグループ)作成
  4. LV(論理ボリューム)作成
  5. ファイルシステム作成
  6. マウント

① パーティション作成

  • fdiskコマンドでディスクをLVM用に分割
  • 例)fdisk /dev/sdc

② PV(物理ボリューム)作成

  • pvcreate でディスクをLVM用に初期化
  • 例)pvcreate /dev/sdc1 /dev/sdd1

③ VG(ボリュームグループ)作成

  • vgcreateで、作成した複数のPVをまとめる
  • 例)vgcreate vg1 /dev/sdc1 /dev/sdd1

④ LV(論理ボリューム)作成

  • VGから必要な容量を取り出す
  • 例)lvcreate -L 100G -n lv_data vg1

⑤ ファイルシステム作成

  • OSが使えるようにする段階。mkfs でLVにファイルシステムを作成、OSが使えるようにする
  • 例)mkfs.ext4 /dev/vg1/lv_data

⑥ マウント

  • OSが使えるようにする段階②。
  • /dev/VG名/LV名 をマウントして利用
  • 例)mount /dev/vg1/lv_data /data

※永続化する場合は、/etc/fstab(マウントの設定を記述する場所)に登録

実際の例

/dataを拡張する場合

pvcreate /dev/sde1
vgextend vg1 /dev/sde1
lvextend -L +50G /dev/vg1/lv_data
resize2fs /dev/vg1/lv_data

以上です!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?