欢迎光临
我们一直在努力

centos7.5 xfs文件系统下扩展lvm卷组

搞了个centos7.5安装12.2rac,安装数据库软件时空间不够,所以打算扩一下lvm。

操作系统版本:

[root@mdb1 ~]# lsb_release -a

LSB Version:    :core-4.1-amd64:core-4.1-noarch

Distributor ID: CentOS

Description:    CentOS Linux release 7.5.1804 (Core)

Release:        7.5.1804

Codename:       Core

sdb盘初始化为物理卷

[root@mdb1 ~]#

pvcreate /dev/sdb


  Physical volume "/dev/sdb" successfully created.

 

将要添加的物理卷加入到vg卷组中

[root@mdb1 ~]# vgs

  VG     #PV #LV #SN Attr   VSize  VFree

  centos   1   1   0 wz–n- 21.53g    0  

[root@mdb1 ~]#

vgextend centos /dev/sdb


  Volume group "centos" successfully extended

[root@mdb1 ~]# vgs

  VG     #PV #LV #SN Attr   VSize   VFree

  centos   2   1   0 wz–n- <29.53g <8.00g

 

扩展lvm

[root@mdb1 ~]# lvs

  LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

  root centos -wi-ao—- 21.53g                                                    

[root@mdb1 ~]#

lvextend -l +100%FREE /dev/mapper/centos-root


  Size of logical volume centos/root changed from 21.53 GiB (5512 extents) to <29.53 GiB (7559 extents).

  Logical volume centos/root successfully resized.

 

此时卷组还没扩展,需要resize一下  

[root@mdb1 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   22G   14G  7.6G  65% /

devtmpfs                 1.4G     0  1.4G   0% /dev

tmpfs                    1.4G     0  1.4G   0% /dev/shm

tmpfs                    1.4G  9.6M  1.4G   1% /run

tmpfs                    1.4G     0  1.4G   0% /sys/fs/cgroup

/dev/sda1                473M  134M  339M  29% /boot

tmpfs                    279M     0  279M   0% /run/user/0

tmpfs                    279M     0  279M   0% /run/user/1001

    

[root@mdb1 ~]#

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.


linux从7开始默认文件系统放弃了第四代ext4的文件系统,转向了xfs日志文件系统。该系统性能比ext4增强很多,扩展性也更强,能够得到近似裸设备的IO性能。该文件系统下的lvm拉伸命令也有了变化,需要xfs_growfs实现之前的resize2fs命令的功能。

[root@mdb1 ~]#

xfs_growfs /dev/mapper/centos-root


meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=1411072 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=0 spinodes=0

data     =                       bsize=4096   blocks=5644288, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal               bsize=4096   blocks=2756, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 5644288 to 7740416

[root@mdb1 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   30G   14G   16G  48% /

devtmpfs                 1.4G     0  1.4G   0% /dev

tmpfs                    1.4G  644M  747M  47% /dev/shm

tmpfs                    1.4G  9.6M  1.4G   1% /run

tmpfs                    1.4G     0  1.4G   0% /sys/fs/cgroup

/dev/sda1                473M  134M  339M  29% /boot

tmpfs                    279M     0  279M   0% /run/user/0

完成!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。