说明:系统版本为 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. 利用工具爬取网站所有的html和js文件

    例图: 该工具下载地址为:http://www.tenmax.com/teleport/ultra/download.htm

  2. Druid源码阅读之连接池

    概述 Druid是阿里巴巴开源的一个数据库连接池 源码地址.下面简单分析一下连接池是怎么实现的 怎么开始阅读 如果使用过Druid连接池的都只要在Spring配置中配置jdbc的时候配置Driver是 ...

  3. iOS如何提高页面流畅度

    A.提高CPU性能 对象创建1.尽量用轻量的对象代替重量的对象,比如CALayer 比 UIView 要轻量许多,如果不考虑交互事件的话,可以选择CALayer.2.Storyboard和xib加载对 ...

  4. C# 多线程、异步线程、线程池相关知识

    /* 线程池ThreadPool类会在需要时增减池中线程的线程数,直到最大的线程数.池中的最大线程数是可配置的. 在双核CPU中,默认设置为1023个工作线程和1000个I/O线程.也可以指定在创建线 ...

  5. DevOps之域名

    唠叨话 关于德语噢屁事的知识点,仅提供精华汇总,具体知识点细节,参考教程网址,如需帮助,请留言. 域名系统DNS(Domain Name System) 关于域名,知识与技能的层次(知道.理解.运用) ...

  6. 吐槽CSDN--想赚钱想疯了--强行升级皮肤--增加广告位

    一直对CSDN很有好感,和博客园同是技术分享的好平台,但是界面更清爽,用户间互动也较多.在学生时代就一直在用,平时抄个作业,竞赛搜个题,论文需要凑字数等等.当年为了下载一份源代码,或者为了下载某本买不 ...

  7. Xadmin集成富文本编辑器ueditor

    在xadmin中通过自定义插件,实现富文本编辑器,效果如下: 1.首先,pip安装ueditor的Django版本: pip install DjangoUeditor 2.之后需要添加到项目的set ...

  8. typescript 的 polyfill 学习1-Class 继承篇

    Class 继承 js 是多范式的编程语言,同样也是支持面向对象编程的,类 是面向对象中是很重要的概念. 区别于传统的java,c#基于模板的类,js是基于原型的. 类继承一般是通过原型链的方式来实现 ...

  9. git 分支改名

    给一个git分支改名的方法很简单 如果对于分支不是当前分支,可以使用下面代码: git branch -m 原名 新 如果是当前,那么可以使用加上新名字 git branch -m 原名 参见: ht ...

  10. UWP取出图片主色调

    一切都要从风车动漫的新详情页说起... 当我最初拿到风车动漫新详情页的UI设计概念图时,新详情页中有两点: 1.图片的高斯模糊 2.取出图片的主色调(主要用于tag和相关动漫的标题背景) 大概就是要这 ...