lvm扩展文件系统

LVM扩展文件系统

1. 总体流程

  • 创建块设备(fdisk格式化创建分区,并调整为8e)
  • 创建pv
  • 扩展vg
  • 扩展lv
  • 扩展文件系统

2. 创建块设备

流程:

  • fdisk /dev/sdb

  • n一路回车格式化分区

  • t:修改分区类型

  • 8e:修改分区ID为linux LVM

  • w:保存退出

3. 创建pv

[root@6-93 ~]# pvscan
  PV /dev/sda2   VG centos          lvm2 [<99.00 GiB / 4.00 MiB free]
  Total: 1 [<99.00 GiB] / in use: 1 [<99.00 GiB] / in no VG: 0 [0   ]
[root@6-93 ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  centos lvm2 a--  <99.00g 4.00m

[root@6-93 ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
[root@6-93 ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree   
  /dev/sda2  centos lvm2 a--   <99.00g    4.00m
  /dev/sdb1         lvm2 ---  <300.00g <300.00g

4. 扩展vg

[root@6-93 ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   3   0 wz--n- <99.00g 4.00m
[root@6-93 ~]# vgextend /dev/centos /dev/sdb1
  Volume group "centos" successfully extended
[root@6-93 ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree  
  centos   2   3   0 wz--n- 398.99g 300.00g

5. 扩展lv

[root@6-93 ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home centos -wi-ao---- <41.12g                                                    
  root centos -wi-ao----  50.00g                                                    
  swap centos -wi-ao----  <7.88g                                                    
[root@6-93 ~]# lvs /dev/centos/root 
  LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- 50.00g                                                    
[root@6-93 ~]# lvextend -l +100%FREE /dev/centos/root 
  Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 350.00 GiB (89600 extents).
  Logical volume centos/root successfully resized.
[root@6-93 ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home centos -wi-ao---- <41.12g                                                    
  root centos -wi-ao---- 350.00g                                                    
  swap centos -wi-ao----  <7.88g                                                    

6. 扩展文件系统

查看文件系统类型:

[root@6-93 ~]# blkid /dev/mapper/centos-root
/dev/mapper/centos-root: UUID="32d999cc-6f98-48e7-b594-676af898d659" TYPE="xfs" 

扩展文件系统:

[root@6-93 ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512    agcount=28, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=91750400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

查看:

[root@6-93 ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0  100G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   99G  0 part 
  ├─centos-root 253:0    0  350G  0 lvm  /
  ├─centos-swap 253:1    0  7.9G  0 lvm  [SWAP]
  └─centos-home 253:2    0 41.1G  0 lvm  /home
sdb               8:16   0  300G  0 disk 
└─sdb1            8:17   0  300G  0 part 
  └─centos-root 253:0    0  350G  0 lvm  /
sr0              11:0    1 1024M  0 rom  
  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

昌sit!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值