之前都是ext4文件系统的lvm操作,虽然xfs不支持缩容但是可以扩容,这里是在线扩容
[root@aiker01 ~]# lvdisplay /dev/vg1/lv3
--- Logical volume ---
LV Path /dev/vg1/lv3
LV Name lv3
VG Name vg1
LV UUID I4f9zy-OqLx-DRtM-LRs8-FCS8-Ia2R-BcsT4r
LV Write Access read/write
LV Creation host, time aiker01, 2017-12-08 01:21:35 +0800
LV Status available
# open 0
LV Size 700.00 MiB
Current LE 175
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:6
[root@aiker01 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/cl-root xfs 8.6G 5.3G 3.4G 62% /
devtmpfs devtmpfs 2.4G 0 2.4G 0% /dev
tmpfs tmpfs 2.4G 0 2.4G 0% /dev/shm
tmpfs tmpfs 2.4G 8.7M 2.4G 1% /run
tmpfs tmpfs 2.4G 0 2.4G 0% /sys/fs/cgroup
/dev/mapper/cl-home xfs 4.0G 33M 4.0G 1% /home
/dev/mapper/cl-var xfs 3.0G 159M 2.8G 6% /var
/dev/sda2 xfs 497M 132M 366M 27% /boot
tmpfs tmpfs 479M 0 479M 0% /run/user/0
/dev/mapper/vg2-lv2 ext4 3.9G 16M 3.7G 1% /data
/dev/mapper/vg1-lv1 ext4 6.4G 18M 6.1G 1% /mnt
/dev/mapper/vg1-lv3 xfs 697M 26M 672M 4% /temp
**重新设置lv大小**
[root@aiker01 ~]# lvresize -L 800M /dev/vg1/lv3
Size of logical volume vg1/lv3 changed from 700.00 MiB (175 extents) to 800.00 MiB (200 extents).
Logical volume vg1/lv3 successfully resized.
更新lv卷信息(这步很重要)
[root@aiker01 ~]# xfs_growfs /dev/mapper/vg1-lv3
meta-data=/dev/mapper/vg1-lv3 isize=512 agcount=6, agsize=32000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=179200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 179200 to 204800
[root@aiker01 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/cl-root xfs 8.6G 5.3G 3.4G 62% /
devtmpfs devtmpfs 2.4G 0 2.4G 0% /dev
tmpfs tmpfs 2.4G 0 2.4G 0% /dev/shm
tmpfs tmpfs 2.4G 8.7M 2.4G 1% /run
tmpfs tmpfs 2.4G 0 2.4G 0% /sys/fs/cgroup
/dev/mapper/cl-home xfs 4.0G 33M 4.0G 1% /home
/dev/mapper/cl-var xfs 3.0G 159M 2.8G 6% /var
/dev/sda2 xfs 497M 132M 366M 27% /boot
tmpfs tmpfs 479M 0 479M 0% /run/user/0
/dev/mapper/vg2-lv2 ext4 3.9G 16M 3.7G 1% /data
/dev/mapper/vg1-lv1 ext4 6.4G 18M 6.1G 1% /mnt
/dev/mapper/vg1-lv3 xfs 797M 26M 772M 4% /temp
本文转自 喵来个鱼 51CTO博客,原文链接:http://blog.51cto.com/m51cto/2048564,如需转载请自行联系原作者