码迷,mamicode.com
首页 > 其他好文 > 详细

centos7 逻辑卷扩容

时间:2020-05-13 11:52:37      阅读:73      评论:0      收藏:0      [点我收藏+]

标签:eal   block   pvc   %s   create   pvcreate   wfs   crc   inode   

需求

新增加一块盘300G,需要增加到/data中。
技术图片
技术图片

解决方案

增加磁盘 -> 初始化物理卷 -> 扩容卷组 -> 扩容逻辑卷

操作步骤

初始化物理卷

查看磁盘信息

# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   200G  0 disk 
├─sda1            8:1    0     1G  0 part /boot
└─sda2            8:2    0   199G  0 part 
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0   7.9G  0 lvm  
  ├─centos-home 253:2    0    20G  0 lvm  /home
  └─centos-data 253:3    0 121.1G  0 lvm  /data
sdb               8:16   0   300G  0 disk 
sr0              11:0    1  1024M  0 rom  

将新增加的300G sdb初始化为物理卷

# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.
# pvs
  PV         VG     Fmt  Attr PSize    PFree  
  /dev/sda2  centos lvm2 a--  <199.00g      0 
  /dev/sdb          lvm2 ---   300.00g 300.00g

扩容卷组

查看卷组信息

# vgdisplay
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <199.00 GiB
  PE Size               4.00 MiB
  Total PE              50943
  Alloc PE / Size       50943 / <199.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               b6hhPm-vnxI-g6Qv-zJMu-RvOJ-oy2V-lP4QBm

将sdb分的区初始化为物理卷加入到卷组 centos 中

# vgextend centos /dev/sdb 
  Volume group "centos" successfully extended

技术图片

扩容逻辑卷

查看逻辑卷

# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data centos -wi-ao---- 121.12g                                                    
  home centos -wi-ao----  20.00g                                                    
  root centos -wi-ao----  50.00g                                                    
  swap centos -wi-a-----  <7.88g

扩展逻辑卷大小

# lvextend -l +100%FREE   /dev/mapper/centos-data
  Size of logical volume centos/data changed from 121.12 GiB (31007 extents) to <421.12 GiB (107806 extents).
  Logical volume centos/data successfully resized

重新加载逻辑卷的大小

# resize2fs /dev/mapper/centos-data
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-data
Couldn‘t find valid filesystem superblock.

系统文件格式是:
技术图片

xfs格式的需要使用xfs_growfs命令

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

查看大小

[root@vonedaomaster1 ~]# lvs
  LV   VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data centos -wi-ao---- <421.12g                                                    
  home centos -wi-ao----   20.00g                                                    
  root centos -wi-ao----   50.00g                                                    
  swap centos -wi-a-----   <7.88g    

技术图片

centos7 逻辑卷扩容

标签:eal   block   pvc   %s   create   pvcreate   wfs   crc   inode   

原文地址:https://www.cnblogs.com/zoujiaojiao/p/12881222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!