Fedora 15
Sponsored Link

論理ボリュームの管理2011/05/28

[1] 論理ボリュームの作成
# 論理ボリューム 'lv_data' を ボリュームグループ 'vg_data' に50Gの容量で作成

[root@dlp ~]#
lvcreate -L 50G -n lv_data vg_data

  Logical volume "lv_data" created
[2] 論理ボリュームの表示
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_data

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3

[3] 論理ボリュームの名前変更
[root@dlp ~]#
lvrename vg_data lv_data lv_storage
 
# lv_data から lv_storage に変更

  Renamed "lv_data" to "lv_storage" in volume group "vg_data"
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage  
# 変更された

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3

[4] 論理ボリュームのレポート出力
[root@dlp ~]#
lvs

  LV
VG
Attr
LSize
Origin
Snap%
  Move
  Copy%   Convert

  lv_storage
vg_data
-wi-a-
50.00G

  lv_home
vg_dlp
-wi-ao
30.63g

  lv_root
vg_dlp
-wi-ao
20.00g

  lv_swap
vg_dlp
-wi-ao
5.88g

[5] 論理ボリュームのスキャン
[root@dlp ~]#
lvscan

  ACTIVE
'/dev/vg_data/lv_storage' [50.00 GiB] inherit

  ACTIVE
'/dev/vg_dlp/lv_home' [30.63 GiB] inherit

  ACTIVE
'/dev/vg_dlp/lv_root' [20.00 GiB] inherit

  ACTIVE
'/dev/vg_dlp/lv_swap' [5.88 GiB] inherit

[6] 論理ボリュームのスナップショット
# 'lv_storage' のスナップショットを 'snap-lv_storage' という名前で作成

[root@dlp ~]#
lvcreate -s -L 50G -n snap-lv_storage /dev/vg_data/lv_storage

  Logical volume "snap-lv_storage" created
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3
  --- Logical volume ---
  LV Name
/dev/vg_data/snap-lv_storage

  VG Name
vg_data

  LV UUID
Dy0PCV-izK5-vbC5-qoxP-3w1k-GGvw-atL2lU

  LV Write Access
read/write

  LV snapshot status
active destination for /dev/vg_data/lv_storage

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3

[7] 論理ボリュームの拡張 ― 運用中にマウントしたまま実行できます。
[root@dlp ~]#
lvextend -L 100G /dev/vg_data/lv_storage
 
# 100Gに拡張

  Extending logical volume lv_storage to 100.00 GiB
  Logical volume lv_storage successfully resized
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  \# open
0

  LV Size
100.00 GiB  
# 変更された

  Current LE
25600

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3
[root@dlp ~]#
resize2fs /dev/vg_data/lv_storage
 
# サイズ変更

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VZ/FD3S is mounted on /; on-line resizing required
Resizing the filesystem on /dev/vg_data/lv_storage to 39321600 (4k) blocks.
The filesystem on /dev/vg_data/lv_storage is now 39321600 blocks long.
[8] 論理ボリュームの縮小 ― この操作はファイルシステムの破壊を伴うため、事前にバックアップの取得が必要です。
[root@dlp ~]#
lvreduce -L 50G /dev/vg_data/lv_storage
 
# 50Gに縮小

  WARNING: Reducing active logical volume to 50.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_storage? [y/n]:
y

  Reducing logical volume lv_storage to 50.00 GiB
  Logical volume lv_storage successfully resized
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  \# open
0

  LV Size
50.00 GB  
# 変更された

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3
[9] 論理ボリュームの削除 ― マウント解除して実行します。
[root@dlp ~]#
lvremove /dev/vg_data/lv_storage

Do you really want to remove active logical volume lv_storage? [y/n]:
y

  Logical volume "lv_storage" successfully removed
関連コンテンツ