添加新硬盘,扩展Centos7根分区
##背景介绍,系统安装时,分配的硬盘容量太小,根分区空间不够用,现添加一个新硬盘,通过以下步骤来扩展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根分区的更多相关文章
- CentOS添加新硬盘到新的分区(xfs/ext4) 或者添加新分区
CentOs添加新硬盘到新的分区(xfs/ext4) 添加新分区 转载请注明:http://www.cnblogs.com/juandx/p/5618162.html 这篇文章介绍怎么添加一块新的硬 ...
- Linux Centos7 根分区磁盘扩容[详解]
CentOS7 根分区扩容 [详细过程] 前提 1.如果原来的系统根分区为逻辑卷分区 则可以使用如下的方法 如果不是则不可以 2.如果原来的系统根分区不是逻辑卷分区 则不可以扩展只能再添加挂在磁盘进行 ...
- linux 添加新硬盘的方法
在服务器上把硬盘接好,启动linux,以root登陆. 比如我新加一块SCSI硬盘,需要将其分成三个区: #fdisk /dev/sdb 进入fdisk模式: Command (m for help) ...
- 烂泥:centos6.4服务器添加新硬盘
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 公司FTP服务器的空间又不够了,唉,没有办法只能新加硬盘了.因为以前没有给Linux服务器添加过硬盘,所以只能先在虚拟机中进行模拟. 新加硬盘的操作步骤 ...
- linux系统下添加新硬盘的方法详解
对于linux新手来说,在linux上添加新硬盘,是很有挑战性的一项工作. 在Linux服务器上把硬盘接好,启动linux,以root登陆. fdisk -l ## 这里是查看目前系统上有几块硬盘 D ...
- 在ubuntu中添加新硬盘
在ubuntu中添加新硬盘 转载于 http://www.cnblogs.com/unipower/archive/2009/03/08/1406230.html 前言 安装新硬盘这种事情并不会经常 ...
- Linux添加新硬盘自动挂载硬盘
Linux添加新硬盘自动挂载硬盘的具体步骤 1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘 #fdisk -l Disk /dev/sdb: 1000.2 GB, 1000204 ...
- Linux上添加新硬盘的实例介绍
在Linux上添加新硬盘的实例讲解,有需要的朋友可以看看. 系统:Redhat AS3 UP3硬盘:scsi注意:# 表示是root用户执行的命令 [root@cncmail data1]# fdis ...
- 详解VMware 虚拟机中添加新硬盘的方法
一.VMware新增磁盘的设置步骤 (建议:在设置虚拟的时候,不要运行虚拟机的系统,不然添加了新的虚拟磁盘则要重启虚拟机) 1.选择“VM”----“设置”并打开,将光标定位在“硬盘(SCSI)”这一 ...
随机推荐
- Codeforces 437D 贪心+并查集
这个题目让我想起了上次在湘潭赛的那道跪死了的题.也是最值问题,这个也是,有n个动物园 每个都有权值 然后被m条路径相连接,保证图是连通的,然后求所有的p[i][j]之和.i,j为任意两个zoo,pij ...
- 给vector对象添加元素的方法
#include<iostream> #include<vector> using namespace std; int main() { //初始化10个元素,每个值都为0 ...
- 干货 | 利用京东云Web应用防火墙实现Web入侵防护
摘要 本指南描述如何利用京东云Web应用防火墙(简称WAF),对一个简单的网站(无论运行在京东云.其它公有云或者IDC)进行Web完全防护的全过程.该指南包括如下内容: 准备环境 在京东云上准备Web ...
- awk下 gsub函数用法
(2012-03-27 01:37:28) 标签: awk gsub linux 函数 it 分类: linux gsub函数则使得在所有正则表达式被匹配的时候都发生替换 gsub(regular ...
- ubuntu搭建web服务器
https://www.linuxidc.com/Linux/2015-11/125477.htm 到“sudo apt-get install libapache2-mod-php5”出现1错误.
- 86.QuerySet API常用的方法详解:get方法
get方法的查询条件只能有一条数据满足,如果匹配到多条数据都满足,就会报错:如果没有匹配到满足条件的数据,也会报错. 示例代码如下: from django.http import HttpRespo ...
- JQuery与JS比较
备注:原文转自脚本之家,原文地址:http://www.jb51.net/article/39494.htm 转载仅为方便统一整理收藏内容,别无他意 JQuery与JS的比较: jquery ...
- PAT Basic 1083 是否存在相等的差 (20) [hash映射,map STL]
题目 给定 N 张卡⽚,正⾯分别写上 1.2.--.N,然后全部翻⾯,洗牌,在背⾯分别写上 1.2.--. N.将每张牌的正反两⾯数字相减(⼤减⼩),得到 N 个⾮负差值,其中是否存在相等的差? 输⼊ ...
- nginx中rewrite flag
rewrite 正则表达式 新URI [flag]; [flag] 选项用于调控重写的行为,它的取值可能是: last:重写完成后,会停止继续处理当前区块所有属于ngx_http_rewrite ...
- 数组,字符串方法总结 Unicode 数字
String.prototype.charCodeAt(index) 就是返回字符串中下标单个数值 对应的编码表的10进制表示数值 方法返回0到65535之间的整数,表示给定索引处的UTF-16代码 ...