PC

玄柴:LVMのHDDを交換するテスト

玄柴にLVMを構築し、玉交換する実験。ちなみに、HDDはeSATAで玄人志向のPM5P-SATA2(5ポートマルチプライヤボード)で接続している。まぁ、性能はさておきな不要HDDによるでっかいファイル置き場の予定。

現時点で、pv1つ。500GのHDDがある状態。

# pvdisplay
— Physical volume —
PV Name               /dev/sdb1
VG Name               vg00
PV Size               465.76 GiB / not usable 9.50 MiB
Allocatable           yes (but full)
PE Size               128.00 MiB
Total PE              3726
Free PE               0
Allocated PE          3726
PV UUID               4cQNDe-V0GR-twPT-lR0g-D2NQ-IeYa-Ya3SBp

# vgdisplay
— Volume group —
VG Name               vg00
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  2
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                1
Act PV                1
VG Size               465.75 GiB
PE Size               128.00 MiB
Total PE              3726
Alloc PE / Size       3726 / 465.75 GiB
Free  PE / Size       0 / 0
VG UUID               95PBym-l3Er-lZb4-MTt1-6opO-NTyP-HqzLi2

# lvdisplay
— Logical volume —
LV Name                /dev/vg00/lv00
VG Name                vg00
LV UUID                utmqLH-I5xE-vSBT-RYSf-BWab-vEAn-0ELMD2
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                465.75 GiB
Current LE             3726
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           254:0

1.交換用のHDDを接続
/dev/sda1をLinux LVM(8e)にしてある。1Tです。
2.pvを作成

# pvcreate /dev/sda1
Physical volume “/dev/sda1” successfully created

3.vgに入れる

# vgextend vg00 /dev/sda1
Volume group “vg00” successfully extended

vg内はこんな感じ

# pvdisplay
— Physical volume —
PV Name               /dev/sdb1
VG Name               vg00
PV Size               465.76 GiB / not usable 9.50 MiB
Allocatable           yes (but full)
PE Size               128.00 MiB
Total PE              3726
Free PE               0
Allocated PE          3726
PV UUID               4cQNDe-V0GR-twPT-lR0g-D2NQ-IeYa-Ya3SBp

— Physical volume —
PV Name               /dev/sda1
VG Name               vg00
PV Size               931.51 GiB / not usable 11.19 MiB
Allocatable           yes
PE Size               128.00 MiB
Total PE              7452
Free PE               7452
Allocated PE          0
PV UUID               eS41BG-Oen9-5fu8-fXF0-8GDe-YLpb-b12EDd

4.PEの移動

# pvmove /dev/sdb1
/dev/sdb1: Moved: 0.0%
/dev/sdb1: Moved: 0.2%

/dev/sdb1: Moved: 99.8%
/dev/sdb1: Moved: 99.9%
/dev/sdb1: Moved: 100.0%
#

5.移動結果を見てみる

# pvdisplay
— Physical volume —
PV Name               /dev/sdb1
VG Name               vg00
PV Size               465.76 GiB / not usable 9.50 MiB
Allocatable           yes
PE Size               128.00 MiB
Total PE              3726
Free PE               3726
Allocated PE          0
PV UUID               4cQNDe-V0GR-twPT-lR0g-D2NQ-IeYa-Ya3SBp

— Physical volume —
PV Name               /dev/sda1
VG Name               vg00
PV Size               931.51 GiB / not usable 11.19 MiB
Allocatable           yes
PE Size               128.00 MiB
Total PE              7452
Free PE               3726
Allocated PE          3726
PV UUID               eS41BG-Oen9-5fu8-fXF0-8GDe-YLpb-b12EDd

6.VGからの切り離し

# vgreduce vg00 /dev/sdb1
Removed “/dev/sdb1” from volume group “vg00”

7.PV削除
外したHDDを別に利用するためにPVを消す

# pvremove /dev/sdb1
Labels on physical volume “/dev/sdb1” successfully wiped

8.LV拡張
500G→1Tになったので、LVを拡張する

# vgdisplay
— Volume group —
VG Name               vg00
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  7
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                1
Act PV                1
VG Size               931.50 GiB
PE Size               128.00 MiB
Total PE              7452
Alloc PE / Size       3726 / 465.75 GiB
Free  PE / Size       3726 / 465.75 GiB
VG UUID               95PBym-l3Er-lZb4-MTt1-6opO-NTyP-HqzLi2

PEが3726個追加できるので拡張

# lvextend -l+3726 /dev/vg00/lv00
Extending logical volume lv00 to 931.50 GiB
Logical volume lv00 successfully resized

再チェック

# vgdisplay
— Volume group —
VG Name               vg00
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  8
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                1
Act PV                1
VG Size               931.50 GiB
PE Size               128.00 MiB
Total PE              7452
Alloc PE / Size       7452 / 931.50 GiB
Free  PE / Size       0 / 0
VG UUID               95PBym-l3Er-lZb4-MTt1-6opO-NTyP-HqzLi2

9.xfsの拡張
xfs_growfsで行う。事前にマウントしておく(/mnt/lv00にマウント済み)

# xfs_growfs /mnt/lv00
meta-data=/dev/mapper/vg00-lv00  isize=256    agcount=4, agsize=30523392 blks
=                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=122093568, imaxpct=25
=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=59616, version=2
=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 122093568 to 244187136

Similar Posts

コメントを残す

メールアドレスが公開されることはありません。

*

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください