CentOS 逻辑卷扩容

CentOS 6

查看

fdisk -l

扩容根分区至45G

# 命令格式
# lvextend -L{扩容至目标大小} {扩容的卷名}
lvextend -L45G /dev/mapper/vg_centos6-LogVol03

应用扩容

# 命令格式
# resize2fs {扩容的卷名}
resize2fs /dev/mapper/vg_centos6-LogVol03

CentOS 7 (xfs文件系统)

fdisk -l

扩容opt至30G

# 命令格式
# lvextend -L{扩容至目标大小} {扩容的卷名}
lvextend -L30G /dev/mapper/centos-opt

应用扩容

xfs_growfs /dev/mapper/centos-opt 

扩容根目录

参考

查看磁盘信息

fdisk -l
# 获得要空闲的空间标识  /dev/vdb

新增分区

fdisk /dev/vdb

...
Building a new DOS disklabel with disk identifier 0x232defba.

Command (m for help): **p**
...
   Device Boot      Start         End      Blocks   Id  System

Command (m for help): **n**
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): **p**
Partition number (1-4, default 1): **1**
First sector (2048-209715199, default 2048): **{回车}**
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): **{回车}**
...
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): **t**
Selected partition 1
Hex code (type L to list all codes): **L**
...
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1 80  Old Minix      
Hex code (type L to list all codes): **8e**
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): **p**
...
/dev/sdb1            2048   209715199   104856576   8e  Linux LVM

Command (m for help): **w**
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

创建物理卷

pvcreate /dev/vdb1

查看物理卷信息

pvdisplay

获得目录分区标识 查看卷组信息

vgdisplay

--- Volume group ---
  VG Name               *centos*   # 这里是标识
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               49.51 GiB
  PE Size               4.00 MiB
  Total PE              12674
  Alloc PE / Size       12664 / 49.47 GiB
  Free  PE / Size       10 / 40.00 MiB
  VG UUID               aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7

将新增加的分区/dev/sdb1加入到根目录分区centos_mb-centos7中

vgextend centos /dev/vdb1

重新查看卷组信息

vgdisplay

进行卷扩容

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

应用扩容

xfs_growfs /dev/mapper/centos-root

最后,查看磁盘信息可以看出根目录分区大小已成功扩容

df -h

转载于:https://my.oschina.net/linch/blog/1829638

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值