lv0 vg0 -wi-ao---- 10.00g
逻辑卷的扩容
$ lvextend -L +2G /dev/vg0/lv0
Size of logical volume vg0/lv0 changed from 10.00 GiB (2560 extents) to 12.00 GiB (3072 extents).
Logical volume lv0 successfully resized.
同步文件系统(如果是ext文件系统,则使用resize2fs命令)
$ xfs_growfs /dev/vg0/lv0
meta-data=/dev/mapper/vg0-lv0 isize=256 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
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 2621440 to 3145728
逻辑卷的缩容(只针对ext文件系统)
如何缩减lvs?
$ 首先,取消挂载
umount /mnt/lv0
其次,缩减文件系统
$ resize2fs /dev/vg/lv0 50G ext文件系统缩减到50G
xfs文件系统只能扩不能缩。。。
然后,缩减逻辑卷
$ lvreduce -L 50G /dev/vg/lv0
最后,再挂载
$ mount /dev/vg/lv0 /mnt/lv0
注意!
lvextend -r 选项,就直接resizefs了,因此,就不需要再resize2fs或者xfs_growfs了