# 磁盘扩容10G [root@localhost ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 21. 5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size ( logical/physical ): 512 bytes / 512 bytes I/O size ( minimum/optimal ): 512 bytes / 512 bytes
# PV扩容 [root@localhost ~]# pvresize /dev/sdb Physical volume "/dev/sdb" changed 1 physical volume( s ) resized or updated / 0 physical volume( s ) not resized
[root@localhost ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- <15. 00g 0 /dev/sdb vg_example lvm2 a-- <20. 00g 10. 00g
# VG自动扩容 [root@localhost ~]# vgs VG #PV #LV #SN Attr VSize VFree centos 1 2 0 wz--n- <15. 00g 0 vg_example 1 1 0 wz--n- <20. 00g 10. 00g
# LV扩容 # 因为磁盘换算问题导致失败 [root@localhost ~]# lvextend -L +10G /dev/vg_example/lv_example Insufficient free space: 2560 extents needed, but only 2559 available [root@localhost ~]# lvextend -L +9. 99G /dev/vg_example/lv_example Rounding size to boundary between physical extents: 9. 99 GiB. Size of logical volume vg_example/lv_example changed from 10. 00 GiB ( 2560 extents ) to 19. 99 GiB ( 5118 extents ). Logical volume vg_example/lv_example successfully resized.
[root@localhost ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root centos -wi-ao---- 13. 39g swap centos -wi-ao---- 1. 60g lv_example vg_example -wi-ao---- 19. 99g
# 文件系统扩容 [root@localhost ~]# xfs_growfs /dev/vg_example/lv_example meta-data=/dev/mapper/vg_example-lv_example isize=512 agcount=4, agsize=655104 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=2620416, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 2620416 to 5240832 [root@localhost ~]# df -Th grep /data /dev/mapper/vg_example-lv_example xfs 20G 33M 20G 1% /data
# 扩容完成
|