os: centos 7.4
[root@node1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <19.00g 0
/dev/sda3 centos lvm2 a-- <30.00g <2.00g
[root@node1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 48.99g <2.00g
[root@node1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- <45.00g
swap centos -wi-ao---- 2.00g
[root@node1 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 17G 5.5G 12G 33% /
devtmpfs devtmpfs 985M 0 985M 0% /dev
tmpfs tmpfs 1001M 0 1001M 0% /dev/shm
tmpfs tmpfs 1001M 8.8M 992M 1% /run
tmpfs tmpfs 1001M 0 1001M 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 160M 855M 16% /boot
tmpfs tmpfs 201M 8.0K 201M 1% /run/user/42
tmpfs tmpfs 201M 0 201M 0% /run/user/0
使用 resize2fs时,提示错误
[root@node1 ~]# resize2fs /dev/mapper/centos-root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock.
了解后发现,xfs格式的文件扩充需要使用 xfs_growfs
[root@node1 ~]# xfs
xfs_admin xfs_db xfs_freeze xfs_info xfs_logprint xfs_mkfile xfs_repair
xfs_bmap xfsdump xfs_fsr xfsinvutil xfs_mdrestore xfs_ncheck xfsrestore
xfs_copy xfs_estimate xfs_growfs xfs_io xfs_metadump xfs_quota xfs_rtcp
[root@node1 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1113856 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4455424, 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 4455424 to 11795456
[root@node1 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 45G 5.5G 40G 13% /
devtmpfs devtmpfs 985M 0 985M 0% /dev
tmpfs tmpfs 1001M 0 1001M 0% /dev/shm
tmpfs tmpfs 1001M 8.8M 992M 1% /run
tmpfs tmpfs 1001M 0 1001M 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 160M 855M 16% /boot
tmpfs tmpfs 201M 8.0K 201M 1% /run/user/42
tmpfs tmpfs 201M 0 201M 0% /run/user/0