操作系统升级到centos7后默认的FS变成了xfs
首先找个现成的分区练练手
[root@localhost others]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 28G 5.9G 22G 22% /
devtmpfs devtmpfs 912M 0 912M 0% /dev
tmpfs tmpfs 920M 0 920M 0% /dev/shm
tmpfs tmpfs 920M 8.7M 912M 1% /run
tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 xfs 497M 162M 336M 33% /boot
/dev/mapper/abcvg0-abclv0 xfs 637M 33M 605M 6% /mnt/abc
执行扩容
[root@localhost others]# lvextend -L +1G /dev/abcvg0/abclv0
Extending logical volume abclv0 to 1.62 GiB
Logical volume abclv0 successfully resized
重新resize报错
[root@localhost others]# resize2fs /dev/abcvg0/abclv0
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/abcvg0/abclv0
Couldn't find valid filesystem superblock.
原来是用错命令了xfs用xfs_growfs
root@localhost others]# xfs_growfs /dev/abcvg0/abclv0
meta-data=/dev/mapper/abcvg0-abclv0 isize=256 agcount=4, agsize=40960 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=163840, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=853, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 163840 to 425984
再次查看lv扩展完毕了
[root@localhost others]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 28G 5.9G 22G 22% /
devtmpfs devtmpfs 912M 0 912M 0% /dev
tmpfs tmpfs 920M 0 920M 0% /dev/shm
tmpfs tmpfs 920M 8.7M 912M 1% /run
tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 xfs 497M 162M 336M 33% /boot
/dev/mapper/abcvg0-abclv0 xfs 1.7G 33M 1.6G 2% /mnt/abc
补充:关于xfs压缩我百度、google都找了找好像不支持在线压缩,有知道的朋友告知一下。