lvm逻辑卷的扩容
LVM 逻辑卷扩容
1. 查看逻辑卷组
lvdisplay
[root@mn-test-mysql-18-81 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos # 名字
LV UUID ePj1dX-M6sr-XTDl-2Ace-1uDC-VglY-GBtlA6
LV Write Access read/write
LV Creation host, time localhost, 2023-08-10 20:00:07 +0800
LV Status available
# open 1
LV Size <73.12 GiB
Current LE 18718
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID F1Jiwi-S2fc-XhvI-9AQ2-aJaq-enHG-f1ewc2
LV Write Access read/write
LV Creation host, time localhost, 2023-08-10 20:00:08 +0800
LV Status available
# open 2
LV Size <5.88 GiB
Current LE 1504
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
2. 添加一块磁盘,这里是/dev/sdb [用 fdisk -l 查看]
3. 扩容卷组
vgextend centos /dev/sdb
WARNING: ext4 signature detected on /dev/sdb at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdb.
Physical volume "/dev/sdb" successfully created.
Volume group "centos" successfully extended
4. 查看扩容后的卷组
vgs
[root@mn-test-mysql-18-81 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 278.99g 200.00g
可以看到有200G的剩余空间
5. 扩容卷
lvextend -L +200G /dev/mapper/centos-root
[root@mn-test-mysql-18-81 ~]# lvextend -L +200G /dev/mapper/centos-root
Size of logical volume centos/root changed from <73.12 GiB (18718 extents) to <273.12 GiB (69918 extents).
Logical volume centos/root successfully resized.
6. 刷新
xfs_growfs /dev/mapper/centos-root
[root@mn-test-mysql-18-81 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=4791808 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=19167232, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=9359, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 19167232 to 71596032
再次查看,已经扩容完成了
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App