Show Table of Contents
第5章 LVM 設定の例
この章では、基本的な LVM 設定の例をいくつか紹介します。
5.1. 3 つのディスク上に LVM 論理ボリュームを作成する
この例では、
/dev/sda1、/dev/sdb1、および /dev/sdc1 のディスクで構成される new_logical_volume という LVM 論理ボリュームを作成します。
5.1.1. 物理ボリュームの作成
ボリュームグループ内のディスクを使用するには、それらに LVM 物理ボリュームというラベルを付けます。
警告
このコマンドは、
/dev/sda1、/dev/sdb1、および /dev/sdc1 上のデータを破棄します。
# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
Physical volume "/dev/sda1" successfully created
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created5.1.2. ボリュームグループの作成
以下のコマンドはボリュームグループ
new_vol_group を作成します。
# vgcreate new_vol_group /dev/sda1 /dev/sdb1 /dev/sdc1
Volume group "new_vol_group" successfully createdvgs コマンドを使用すると、新規ボリュームグループの属性を表示することができます。
# vgs
VG #PV #LV #SN Attr VSize VFree
new_vol_group 3 0 0 wz--n- 51.45G 51.45G5.1.3. 論理ボリュームの作成
以下のコマンドは、ボリュームグループ
new_vol_group から論理ボリューム new_logical_volume を作成します。この例では、ボリュームグループの 2GB を使用する論理ボリュームを作成しています。
# lvcreate -L2G -n new_logical_volume new_vol_group
Logical volume "new_logical_volume" created5.1.4. ファイルシステムの作成
以下のコマンドは論理ボリューム上に GFS2 ファイルシステムを作成します。
#mkfs.gfs2 -plock_nolock -j 1 /dev/new_vol_group/new_logical_volumeThis will destroy any data on /dev/new_vol_group/new_logical_volume. Are you sure you want to proceed? [y/n]yDevice: /dev/new_vol_group/new_logical_volume Blocksize: 4096 Filesystem Size: 491460 Journals: 1 Resource Groups: 8 Locking Protocol: lock_nolock Lock Table: Syncing... All Done
以下のコマンドは、論理ボリュームをマウントして、ファイルシステムのディスク領域使用率を報告します。
#mount /dev/new_vol_group/new_logical_volume /mnt[root@tng3-1 ~]#dfFilesystem 1K-blocks Used Available Use% Mounted on /dev/new_vol_group/new_logical_volume 1965840 20 1965820 1% /mnt

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.