使用LVM对硬盘在线扩容

初始状态:

root@control:/dev/nova-volumes# vgdisplay
--- Volume group ---
VG Name nova-volumes
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 5.44 TiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 5.20 TiB
Free PE / Size / 250.73 GiB
VG UUID S0iZeL-0L6o-4Lbu-x2qZ-30bT-nGQ0-i9a8X1
root@control:/var/lib/glance/images# lvdisplay
--- Logical volume ---
LV Path /dev/nova-volumes/novadata
LV Name novadata
VG Name nova-volumes
LV UUID ykTcoP-0Y0o-lGZe-LWZV-RX7n-lnnO-zpLPXp
LV Write Access read/write
LV Creation host, time debian, -- :: +
LV Status available
# open
LV Size 3.91 TiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device :

首先通过lvresize命令将所有Free PE使用完:

lvresize -l + /dev/nova-volumes/novadata

再对硬盘实现在线扩容(风险自负):

root@control:/dev/nova-volumes# resize2fs -p /dev/nova-volumes/novadata
resize2fs 1.42. (-Jul-)
Filesystem at /dev/nova-volumes/novadata is mounted on /nova; on-line resizing required
old_desc_blocks = , new_desc_blocks =
Performing an on-line resize of /dev/nova-volumes/novadata to (4k) blocks.
The filesystem on /dev/nova-volumes/novadata is now blocks long.

结束状态:

root@control:/dev/nova-volumes# vgdisplay
--- Volume group ---
VG Name nova-volumes
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 5.44 TiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 5.44 TiB
Free PE / Size /
VG UUID S0iZeL-0L6o-4Lbu-x2qZ-30bT-nGQ0-i9a8X1
root@control:/dev/nova-volumes# lvdisplay
--- Logical volume ---
LV Path /dev/nova-volumes/novadata
LV Name novadata
VG Name nova-volumes
LV UUID ykTcoP-0Y0o-lGZe-LWZV-RX7n-lnnO-zpLPXp
LV Write Access read/write
LV Creation host, time debian, -- :: +
LV Status available
# open
LV Size 4.15 TiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device :
上一篇:后端开发实践系列之二——领域驱动设计(DDD)编码实践


下一篇:Elasticsearch搜索结果返回不一致问题