##背景介绍,系统安装时,分配的硬盘容量太小,根分区空间不够用,现添加一个新硬盘,通过以下步骤来扩展centos7根分区

 [root@t201 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs .9G .9G % /dev
tmpfs .9G .9G % /dev/shm
tmpfs .9G 8.6M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/mapper/centos-root 14G .2G 12G % /
/dev/sda1 1014M 134M 881M % /boot
tmpfs 797M 797M % /run/user/
[root@t201 ~]# fdisk -l 磁盘 /dev/sda:17.2 GB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节
磁盘标签类型:dos
磁盘标识符:0x000db98a 设备 Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM 磁盘 /dev/sdb:21.5 GB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节 磁盘 /dev/mapper/centos-root:14.4 GB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节 磁盘 /dev/mapper/centos-swap: MB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节 [root@t201 ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.)。 更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。 Device does not contain a recognized partition table
使用磁盘标识符 0xb1065d94 创建新的 DOS 磁盘标签。 命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) 命令(输入 m 获取帮助):n
Partition type:
p primary ( primary, extended, free)
e extended
Select (default p): p
分区号 (-,默认 ):
起始 扇区 (-,默认为 ):
将使用默认值
Last 扇区, +扇区 or +size{K,M,G} (-,默认为 ):
将使用默认值
分区 已设置为 Linux 类型,大小设为 GiB 命令(输入 m 获取帮助):w
The partition table has been altered! Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@t201 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs .9G .9G % /dev
tmpfs .9G .9G % /dev/shm
tmpfs .9G 8.6M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/mapper/centos-root 14G .2G 12G % /
/dev/sda1 1014M 134M 881M % /boot
tmpfs 797M 797M % /run/user/
[root@t201 ~]# fdisk -l 磁盘 /dev/sda:17.2 GB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节
磁盘标签类型:dos
磁盘标识符:0x000db98a 设备 Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM 磁盘 /dev/sdb:21.5 GB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节
磁盘标签类型:dos
磁盘标识符:0xb1065d94 设备 Boot Start End Blocks Id System
/dev/sdb1 Linux 磁盘 /dev/mapper/centos-root:14.4 GB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节 磁盘 /dev/mapper/centos-swap: MB, 字节, 个扇区
Units = 扇区 of * = bytes
扇区大小(逻辑/物理): 字节 / 字节
I/O 大小(最小/最佳): 字节 / 字节 [root@t201 ~]# vgdisplay -v
--- Volume group ---
VG Name centos
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 <15.00 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / <15.00 GiB
Free PE / Size /
VG UUID Fj5EY6-duHB-Vtmx-RaKo-JpuY-UwCy-f3xemr --- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID YKyysg-qNJY-x3sa-HjHm-5JHX-mBRf-mTpVXl
LV Write Access read/write
LV Creation host, time localhost, -- :: +
LV Status available
# open
LV Size 1.60 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : --- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID dLgGwO-UXqd-41WI-C97j-suC8-siWt-3QWQQv
LV Write Access read/write
LV Creation host, time localhost, -- :: +
LV Status available
# open
LV Size 13.39 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : --- Physical volumes ---
PV Name /dev/sda2
PV UUID dzMQgG-eMzE-6Vi4-WHOt-BdDH-KuTt-Ofk0gH
PV Status allocatable
Total PE / Free PE / [root@t201 ~]# pvcreate /dev/sdb
sdb sdb1
[root@t201 ~]# pvcreate /dev/sdb
sdb sdb1
[root@t201 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@t201 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size <15.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE
Free PE
Allocated PE
PV UUID dzMQgG-eMzE-6Vi4-WHOt-BdDH-KuTt-Ofk0gH "/dev/sdb1" is a new physical volume of "<20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size <20.00 GiB
Allocatable NO
PE Size
Total PE
Free PE
Allocated PE
PV UUID G9jtn0-Gg0H-U55j-Hwzs-pafT-Mhtx-doyA9f [root@t201 ~]# vgextend centos /dev/sdb1
Volume group "centos" successfully extended
[root@t201 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID YKyysg-qNJY-x3sa-HjHm-5JHX-mBRf-mTpVXl
LV Write Access read/write
LV Creation host, time localhost, -- :: +
LV Status available
# open
LV Size 1.60 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : --- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID dLgGwO-UXqd-41WI-C97j-suC8-siWt-3QWQQv
LV Write Access read/write
LV Creation host, time localhost, -- :: +
LV Status available
# open
LV Size 13.39 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : [root@t201 ~]# lvextend -l +%Free /dev/centos/root
Size of logical volume centos/root changed from 13.39 GiB ( extents) to 33.39 GiB ( extents).
Logical volume centos/root successfully resized.
[root@t201 ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt= spinodes=
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@t201 ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs .9G .9G % /dev
tmpfs tmpfs .9G .9G % /dev/shm
tmpfs tmpfs .9G 8.6M .9G % /run
tmpfs tmpfs .9G .9G % /sys/fs/cgroup
/dev/mapper/centos-root xfs 34G .2G 32G % /
/dev/sda1 xfs 1014M 134M 881M % /boot
tmpfs tmpfs 797M 797M % /run/user/
[root@t201 ~]#

添加新硬盘,扩展Centos7根分区的更多相关文章

  1. CentOS添加新硬盘到新的分区(xfs/ext4) 或者添加新分区

    CentOs添加新硬盘到新的分区(xfs/ext4)  添加新分区 转载请注明:http://www.cnblogs.com/juandx/p/5618162.html 这篇文章介绍怎么添加一块新的硬 ...

  2. Linux Centos7 根分区磁盘扩容[详解]

    CentOS7 根分区扩容 [详细过程] 前提 1.如果原来的系统根分区为逻辑卷分区 则可以使用如下的方法 如果不是则不可以 2.如果原来的系统根分区不是逻辑卷分区 则不可以扩展只能再添加挂在磁盘进行 ...

  3. linux 添加新硬盘的方法

    在服务器上把硬盘接好,启动linux,以root登陆. 比如我新加一块SCSI硬盘,需要将其分成三个区: #fdisk /dev/sdb 进入fdisk模式: Command (m for help) ...

  4. 烂泥:centos6.4服务器添加新硬盘

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 公司FTP服务器的空间又不够了,唉,没有办法只能新加硬盘了.因为以前没有给Linux服务器添加过硬盘,所以只能先在虚拟机中进行模拟. 新加硬盘的操作步骤 ...

  5. linux系统下添加新硬盘的方法详解

    对于linux新手来说,在linux上添加新硬盘,是很有挑战性的一项工作. 在Linux服务器上把硬盘接好,启动linux,以root登陆. fdisk -l ## 这里是查看目前系统上有几块硬盘 D ...

  6. 在ubuntu中添加新硬盘

    在ubuntu中添加新硬盘 转载于 http://www.cnblogs.com/unipower/archive/2009/03/08/1406230.html  前言 安装新硬盘这种事情并不会经常 ...

  7. Linux添加新硬盘自动挂载硬盘

    Linux添加新硬盘自动挂载硬盘的具体步骤 1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘 #fdisk -l Disk /dev/sdb: 1000.2 GB, 1000204 ...

  8. Linux上添加新硬盘的实例介绍

    在Linux上添加新硬盘的实例讲解,有需要的朋友可以看看. 系统:Redhat AS3 UP3硬盘:scsi注意:# 表示是root用户执行的命令 [root@cncmail data1]# fdis ...

  9. 详解VMware 虚拟机中添加新硬盘的方法

    一.VMware新增磁盘的设置步骤 (建议:在设置虚拟的时候,不要运行虚拟机的系统,不然添加了新的虚拟磁盘则要重启虚拟机) 1.选择“VM”----“设置”并打开,将光标定位在“硬盘(SCSI)”这一 ...

随机推荐

  1. 吴裕雄--天生自然TensorFlow2教程:合并与分割

    import tensorflow as tf # 6个班级的学生分数情况 a = tf.ones([4, 35, 8]) b = tf.ones([2, 35, 8]) c = tf.concat( ...

  2. Vue-router的介绍

    1.路由基础介绍 (1)什么是前端路由: 路由是根据不同的URL地址展示不同的内容或页面. 前端路由就是把不同路由对应不同的内容或页面的任务交给前端来做.之前是通过服务端根据URL的不同返回不同的页面 ...

  3. 18 12 30 服务器 Django 的初步使用 环境变量的调整

    1.安装django 1.1.下载Django包 https://www.djangoproject.com/download/https://www.djangoproject.com/m/rele ...

  4. 基本pipline用法

    #!groovynode { stage('代码获取') { checkout([$class: 'SubversionSCM', additionalCredentials: [], exclude ...

  5. PPT |《Kubernetes的兴起》

    京东云开发者社区技术沙龙--<Cloud Native时代的应用之路与开源创新> Part1-<Kubernetes的兴起> 欢迎点击"链接"了解更多精彩内 ...

  6. MySQL性能管理及架构设计:第1章 实例和故事

    1-1 什么决定了电商双11大促的成败 数据库架构 1-2 在双11大促中的数据库服务器 通过监控信息从而确定:哪些因素影响了数据库性能? 1-3 在大促中什么影响了数据库性能 1-4 大表带来的问题 ...

  7. Mybatix实现in查询(五)

    在这一节,我们要向大家介绍一下在Mybatis中想要实现in查询,Mapper文件应该怎么配置. 1)在com.mybatis.dao.PartDao中增加接口函数 public List<Pa ...

  8. Eclipse上传Git远程仓库,并且增加Maven Dependencies

    前言: 遇见问题了,公司一台电脑,家里一台电脑,当有项目在进行的时候,又不想把电脑背来背去的,就像一个人玩单机,这个时候GIT就可以帮你解决这个问题.当GIT准备就绪的时候,新的问题来了git下载下载 ...

  9. Java 语句while、do while、for循环、嵌套、for与while的区别、break continue(3)

    for循环语句,双从for嵌套: /* for(初始化表达式:循环条件表达式:循环后的操作表达式) { 执行语句: } */ /*1,变量有自己的作用域.对于for来讲:如果将用于控制循环的增量定义在 ...

  10. Python说文解字_杂谈01

    1. Python在Ubuntu下面下载Python 2. 安装依赖包 sudo apt-get update sudo apt-get install build-essential python- ...