RedHat 7.4 xfs格式LV扩容

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RedHat 7.4 xfs格式LV扩容相关的知识,希望对你有一定的参考价值。

1、需要扩容的LV为LV01,扩容容量+100GB

[[email protected] /]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root  292G  3.3G  289G   2% /
devtmpfs               2.0G     0  2.0G   0% /dev
tmpfs                  2.0G     0  2.0G   0% /dev/shm
tmpfs                  2.0G  8.9M  2.0G   1% /run
tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1              497M  154M  344M  31% /boot
tmpfs                  395M   32K  395M   1% /run/user/0
/dev/mapper/VG01-LV01  149G  3.1G  146G   3% /test

2、查看LV大小,LV01大小为149G

[[email protected] /]# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  LV01 VG01 -wi-ao---- 149.00g                                                    
  root rhel -wi-ao---- 291.69g                                                    
  swap rhel -wi-ao----   7.81g                                                    
[[email protected] /]# 

3、查看VG大小,VG01剩余空间为50G,不满足扩容要求

[[email protected] /]# vgs
  VG   #PV #LV #SN Attr   VSize   VFree 
  VG01   2   1   0 wz--n- 199.99g 50.99g
  rhel   2   2   0 wz--n- 299.50g     0 
[[email protected] /]# 

4、格式化新添加的磁盘

[[email protected] /]# mkfs.xfs /dev/vdc1 
meta-data=/dev/vdc1              isize=512    agcount=4, agsize=6553536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=26214144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=12799, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[[email protected] /]# 

5、创建PV

[[email protected] /]# pvcreate /dev/vdc1
WARNING: xfs signature detected on /dev/vdc1 at offset 0. Wipe it? [y/n]: y
  Wiping xfs signature on /dev/vdc1.
  Physical volume "/dev/vdc1" successfully created.
[[email protected] /]# 

6、VG扩容和查看

[[email protected] /]# vgextend VG01 /dev/vdc1
  Volume group "VG01" successfully extended
[[email protected] /]# vgs
  VG   #PV #LV #SN Attr   VSize    VFree   
  VG01   3   1   0 wz--n- <299.99g <150.99g
  rhel   2   2   0 wz--n-  299.50g       0 
[[email protected] /]# 

7、LV扩容和查看

[[email protected] /]# lvextend -L +100GB /dev/VG01/LV01 
  Size of logical volume VG01/LV01 changed from 149.00 GiB (38144 extents) to 249.00 GiB (63744 extents).
  Logical volume VG01/LV01 successfully resized.
[[email protected] /]# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  LV01 VG01 -wi-ao---- 249.00g                                                    
  root rhel -wi-ao---- 291.69g                                                    
  swap rhel -wi-ao----   7.81g                                                    
[[email protected] /]# 

8、查看df -h 查看容量变化,发现没有变化

[[email protected] /]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root  292G  3.3G  289G   2% /
devtmpfs               2.0G     0  2.0G   0% /dev
tmpfs                  2.0G     0  2.0G   0% /dev/shm
tmpfs                  2.0G  8.9M  2.0G   1% /run
tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1              497M  154M  344M  31% /boot
tmpfs                  395M   32K  395M   1% /run/user/0
/dev/mapper/VG01-LV01  149G  3.1G  146G   3% /test
[[email protected] /]# 

9、使用xfs_growfs同步磁盘信息

[[email protected] /]# xfs_growfs /dev/mapper/VG01-LV01 
meta-data=/dev/mapper/VG01-LV01  isize=512    agcount=7, agsize=6488064 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=39059456, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=12672, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 39059456 to 65273856
[[email protected] /]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root  292G  3.3G  289G   2% /
devtmpfs               2.0G     0  2.0G   0% /dev
tmpfs                  2.0G     0  2.0G   0% /dev/shm
tmpfs                  2.0G  8.9M  2.0G   1% /run
tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1              497M  154M  344M  31% /boot
tmpfs                  395M   32K  395M   1% /run/user/0
/dev/mapper/VG01-LV01  249G  3.1G  246G   2% /test
[[email protected] /]# 

喜欢我的文章,可以关注我的微信公众号运维少年哦!

以上是关于RedHat 7.4 xfs格式LV扩容的主要内容,如果未能解决你的问题,请参考以下文章

10.lv扩容报错:resize2fs: Bad magic number in super-block while trying to open

xfs文件系统lvm在线扩容

redhat 6.5 lv 扩容

RedHat 6 创建和扩容LVM卷

Linux -lvm -扩容缩容逻辑卷(针对ext4)

centos7 / redhat 7的分区扩容