0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【lvm】ディスクを追加して論理ボリュームをオンライン拡張

Last updated at Posted at 2023-01-11

概要

  • LVM (Logical Volume Manager) を利用したオンラインボリューム拡張
  • クラウドで徐々にボリュームを増やす場合等で利用

LVM

手順

disk を認識させる

echo "- - -" | tee /sys/class/scsi_host/host*/scan

既存の情報を調べる

  • pv (physical volumes)
pvs
pvdisplay
  • vg (volume groups)
vgs
vgdisplay
  • lv (logical volumes)
lvs
lvdisplay

物理ボリューム/pv(ディスク)を追加

  • 確認コマンド
lvmdiskscan
  • 追加ディスクの内容があるか確認 (/dev/sdb等)
  /dev/ram0              [      16.00 MiB]
  /dev/root              [      50.00 GiB]
  /dev/ram1              [      16.00 MiB]
  /dev/sda1              [     500.00 MiB]
  /dev/VolGroup00/LogVol01 [       5.77 GiB]
  /dev/ram2              [      16.00 MiB]
  /dev/sda2              [     465.27 GiB] LVM physical volume
  /dev/VolGroup00/LogVol00 [     409.50 GiB]
  /dev/sdb               [     XXX.XX GiB]

physical volume (/dev/sdb) を追加

  • pv 作成
pvcreate /dev/sdb
  • 確認
lvmdiskscan -l
pvs
pvdisplay

volume group に physical volume 追加

  • vg 拡張 (対象は vgs で出力される VolGroup00など vg名)
vgextend VolGroup00 /dev/sdb

logical volume の容量を拡張

  • lv 拡張 (対象は lvdisplay の LV Name)
lvextend -l +100%FREE /dev/VolGroup00/LogVol00

ファイルシステム拡張(オンライン拡張)

  • resize2fs (対象は df コマンドで出力される Filesystem名)
resize2fs -p /dev/mapper/VolGroup00-LogVol00

拡張確認

df -h

以上、お疲れ様でした!

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?