说明:系统版本为 Linux version 3.10.0-327.el7.x86_64

step1. 查看现有磁盘信息,可以看出根分区有45G

[root@DEV-CMDB-DB02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_mb--centos7-root 45G .8G 35G % /
devtmpfs .9G .9G % /dev
tmpfs .9G 84K .9G % /dev/shm
tmpfs .9G 8.9M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 497M 142M 356M % /boot
tmpfs .2G 16K .2G % /run/user/
tmpfs .2G .2G % /run/user/

step2. 查看新增加的磁盘信息

[root@DEV-CMDB-DB02 ~]# fdisk -l

Disk /dev/sda: 53.7 GB,  bytes,  sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x000e0945 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM Disk /dev/sdb: 107.4 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/centos_mb--centos7-root: 47.7 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/centos_mb--centos7-swap: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes

step3. 根据以上信息,对新增加的磁盘进行分区

[root@DEV-CMDB-DB02 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.). Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x232defba. Command (m for help): p Disk /dev/sdb: 107.4 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x232defba Device Boot Start End Blocks Id System Command (m for help): n
Partition type:
p primary ( primary, extended, free)
e extended
Select (default p): p
Partition number (-, default ):
First sector (-, default ):
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ):
Using default value
Partition of type Linux and of size GiB is set Command (m for help): t
Selected partition
Hex code (type L to list all codes): L Empty NEC DOS Minix / old Lin bf Solaris
FAT12 Hidden NTFS Win Linux swap / So c1 DRDOS/sec (FAT-
XENIX root Plan Linux c4 DRDOS/sec (FAT-
XENIX usr 3c PartitionMagic OS/ hidden C: c6 DRDOS/sec (FAT-
FAT16 <32M Venix Linux extended c7 Syrinx
Extended PPC PReP Boot NTFS volume set da Non-FS data
FAT16 SFS NTFS volume set db CP/M / CTOS / .
HPFS/NTFS/exFAT 4d QNX4.x Linux plaintext de Dell Utility
AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
AIX bootable 4f QNX4.x 3rd part Amoeba e1 DOS access
a OS/ Boot Manag OnTrack DM Amoeba BBT e3 DOS R/O
b W95 FAT32 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
OPUS EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
Hidden FAT12 Golden Bow a8 Darwin UFS f1 SpeedStor
Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
Hidden FAT16 < SpeedStor ab Darwin boot f2 DOS secondary
Hidden FAT16 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
Hidden HPFS/NTF Novell Netware b7 BSDI fs fc VMware VMKCORE
AST SmartSleep Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p Disk /dev/sdb: 107.4 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x232defba Device Boot Start End Blocks Id System
/dev/sdb1 8e Linux LVM Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.

step4. 创建物理卷

[root@DEV-CMDB-DB02 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created

step5. 查看物理卷信息

[root@DEV-CMDB-DB02 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos_mb-centos7
PV Size 49.51 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE
Free PE
Allocated PE
PV UUID 8WbgjB-T1Lf-kqUD-qPFw-UwJu-B9Lc-GAUTUB "/dev/sdb1" is a new physical volume of "100.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 100.00 GiB
Allocatable NO
PE Size
Total PE
Free PE
Allocated PE
PV UUID HOknRs-TnMy-wtfX-sGqD-5RK9-dk9q-ze13fj
[root@DEV-CMDB-DB02 ~]# vgdisplay
--- Volume group ---
VG Name centos_mb-centos7
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 49.51 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 49.47 GiB
Free PE / Size / 40.00 MiB
VG UUID aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7

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

[root@DEV-CMDB-DB02 ~]# vgextend centos_mb-centos7 /dev/sdb1
Volume group "centos_mb-centos7" successfully extended

step7. 重新查看卷组信息

[root@DEV-CMDB-DB02 ~]# vgdisplay
--- Volume group ---
VG Name centos_mb-centos7
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 149.50 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 49.47 GiB
Free PE / Size 25609 / 100.04 GiB
VG UUID aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7

step9. 进行卷扩容

[root@DEV-CMDB-DB02 ~]# lvextend -l +%FREE /dev/mapper/centos_mb--centos7-root
Size of logical volume centos_mb-centos7/root changed from 44.47 GiB ( extents) to 144.50 GiB ( extents).
Logical volume root successfully resized.

step10. 调整卷分区大小

[root@DEV-CMDB-DB02 ~]# xfs_growfs /dev/mapper/centos_mb--centos7-root
meta-data=/dev/mapper/centos_mb--centos7-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt=
data = bsize= blocks=, imaxpct=
= sunit= swidth= blks
naming =version bsize= ascii-ci= ftype=
log =internal bsize= blocks=, version=
= sectsz= sunit= blks, lazy-count=
realtime =none extsz= blocks=, rtextents=
data blocks changed from to

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

[root@DEV-CMDB-DB02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_mb--centos7-root 145G .8G 135G % /
devtmpfs .9G .9G % /dev
tmpfs .9G 84K .9G % /dev/shm
tmpfs .9G 8.9M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 497M 142M 356M % /boot
tmpfs .2G 16K .2G % /run/user/
tmpfs .2G .2G % /run/user/

CentOS7.x系统根目录分区扩容的更多相关文章

  1. CentOS 7系统根目录分区扩容

    说明:系统版本为 Linux version 3.10.0-327.el7.x86_64 1. 查看现有磁盘信息,可以看出根分区有45G [root@DEV-CMDB-DB02 ~]# df -h F ...

  2. CentOS 7 根目录分区扩容

    查看现有磁盘信息,可以看出根分区有96G [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mappe ...

  3. 双系统Ubuntu分区扩容过程记录

    本人电脑上安装了Win10 + Ubuntu 12.04双系统.前段时间因为在Ubuntu上做项目要安装一个比较大的软件,导致Ubuntu根分区的空间不够了.于是,从硬盘又分出来一部分空间,分给Ubu ...

  4. 如何在Virtualbox中对Ubuntu系统根分区扩容

    转载:             参见博客: https://blog.csdn.net/LEON1741/article/details/56494797 前在Virtualbox中安装了一个Ubun ...

  5. CentOS7,非LVM根分区扩容步骤:

    1.查看现有的分区大小 非LVM分区,目前磁盘大小为40G,根分区总容量为40G,(是自定义分区安装的) 2.关机增加磁盘大小至100G 如果你们是vmwaer虚拟软件安装的那如下入扩容: 3.查看磁 ...

  6. Ubuntu系统分配存储空间的建议以及给Ubuntu系统根目录扩容方法(从20GB追加100GB)

    当初准备装双系统时,也思考了很久分配多少空间给Ubuntu16.04系统,查了许多资料,大多意思是‘/’目录总共给20GB,其他的给/home.网上资料推荐的大多跟这篇文章一样:https://blo ...

  7. Linux系统LVM分区减容扩容

    Linux系统LVM分区减容扩容 目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root 1.首先查看磁盘使用情况 [root@localhost ...

  8. Ubuntu 18.04 磁盘根目录在线扩容 & 修改分区 inode 数量

    Ubuntu 18.04 磁盘根目录在线扩容 & 修改分区 inode 数量   Ubuntu 作为服务器系统使用的时候,系统盘的空间可能并不是很充裕,apt apt 着,根目录就满了.诚然, ...

  9. VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容

    VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容 一般来说,在对虚拟机里的Ubuntu下的磁盘进行扩容时,都是添加新的分区,而并不是对其系统所在分区进行扩容,如在此链接中http ...

随机推荐

  1. 初学者易上手的SSH-struts2 01环境搭建

    首先,SSH不是一个框架,而是多个框架(struts+spring+hibernate)的集成,是目前较流行的一种Web应用程序开源集成框架,用于构建灵活.易于扩展的多层Web应用程序. 集成SSH框 ...

  2. Python自学笔记-filter()函数(来自廖雪峰的官网Python3)

    感觉廖雪峰的官网http://www.liaoxuefeng.com/里面的教程不错,所以学习一下,把需要复习的摘抄一下. 以下内容主要为了自己复习用,详细内容请登录廖雪峰的官网查看. Python内 ...

  3. Python 基础之函数、深浅copy,set及练习

    三元运算符通常在Python里被称为条件表达式,这些表达式基于真(true)/假(not)的条件判断,在Python 2.4以上才有了三元操作. 语法格式: X if C else Y 有了三元表达式 ...

  4. 一道javascript面试题(闭包与函数柯里化)

    要求写一个函数add(),分别实现能如下效果: (1)console.log(add(1)(2)(3)(4)()); (2)console.log(add(1,2)(3,4)()); (3)conso ...

  5. jquery系列教程6-ajax的应用全解

    点击打开: jquery系列教程1-选择器全解 jquery系列教程2-style样式操作全解 jquery系列教程3-DOM操作全解 jquery系列教程4-事件操作全解 jquery系列教程5-动 ...

  6. event模拟数据库链接

    from threading import Thread,Event,currentThread import time e = Event() def conn_mysql(): count = 1 ...

  7. Centos 7.3 安装配置 PostgreSQL 9.x

    一.安装 PostgresSQL Centos 7 自带的 PostgresSQL 是 9.2 版的.因为,yum 已经做了国内源,速度飞快,所以直接就用 yum 安装了.依次执行以下命令即可,非常简 ...

  8. eclipse创建一个文件夹

    如何给eclipse创建一个文件夹,便于项目的管理:有时我们的eclipse中会有很多项目的,有的是公司的如Project1,Project2,Project3....还有的呢, 也可能是自己平时做的 ...

  9. LeetCode 229. Majority Element II (众数之二)

    Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorit ...

  10. CNCC2017梳理

    大牛云集的中国计算机大会:大会日程表:http://cncc.ccf.org.cn/cn/news/schedule_empty 早上的论坛可以在爱奇艺下载视频 下午的分论坛是多个同时进行的,我也只去 ...