CentOS7逻辑卷扩容成功后,df查看发现实际容量并没有增加,lvs查看则已经是扩容之后的大小,使用resize2fs报错:

[root@Linux ~]# lvs
  LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- 48.00g
  
[root@Linux ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  8.8M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   48G  1.7G   47G   4% /
/dev/sda1                297M  171M  126M  58% /boot
tmpfs                    783M     0  783M   0% /run/user/0

[root@Linux ~]# 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需要用另外的命令扩容:

[root@Linux ~]# df -T
Filesystem              Type     1K-blocks    Used Available Use% Mounted on
devtmpfs                devtmpfs   3992428       0   3992428   0% /dev
tmpfs                   tmpfs      4004216       0   4004216   0% /dev/shm
tmpfs                   tmpfs      4004216    9032   3995184   1% /run
tmpfs                   tmpfs      4004216       0   4004216   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs      102731776 1737132 100994644   2% /
/dev/sda1               xfs         303780  175004    128776  58% /boot
tmpfs                   tmpfs       800844       0    800844   0% /run/user/0

[root@Linux ~]# xfs_growfs /dev/centos/root 
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=3145728 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=12582912, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=6144, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 12582912 to 25689088

[root@Linux ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  8.8M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   98G  1.7G   97G   2% /
/dev/sda1                297M  171M  126M  58% /boot
tmpfs                    783M     0  783M   0% /run/user/0