虚拟化下Centos7 扩容根分区
- 查看分区大小和挂载情况 用到的命令df、lsblk
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 99G 96G 3.9G 97% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 33M 3.8G 1% /dev/shm
tmpfs 3.9G 27M 3.8G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vda1 1014M 189M 826M 19% /boot
tmpfs 6.4G 0 6.4G 0% /run/user/0
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sr0 11:0 1 1024M 0 rom
vda 252:0 0 200G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 99G 0 part
└─centos-root 253:0 0 99G 0 lvm /

- 又原来的100G 调整虚拟机磁盘为200G 直接调整。

- 创建分区
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/vda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a727a
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 2099199 1048576 83 Linux
/dev/vda2 2099200 209715199 103808000 8e Linux LVM
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (209715200-419430399, default 209715200):
Using default value 209715200
Last sector, +sectors or +size{K,M,G} (209715200-419430399, default 419430399):
Using default value 419430399
Partition 3 of type Linux and of size 100 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]#

- 刷新分区并创建物理卷
[root@localhost ~]# partprobe /dev/vda
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sr0 11:0 1 1024M 0 rom
vda 252:0 0 200G 0 disk
├─vda1 252:1 0 1G 0 part /boot
├─vda2 252:2 0 99G 0 part
│ └─centos-root 253:0 0 99G 0 lvm /
└─vda3 252:3 0 100G 0 part
[root@localhost ~]# partprobe /dev/vda3
- 查看卷组名称,以及卷组使用情况
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <99.00 GiB
PE Size 4.00 MiB
Total PE 25343
Alloc PE / Size 25343 / <99.00 GiB
Free PE / Size 0 / 0
VG UUID wEdhD1-PJnZ-gSBB-ZE4X-pMKK-Obor-b7JnO2
6.扩展卷组
[root@localhost ~]# vgextend centos /dev/vda3
Physical volume "/dev/vda3" successfully created.
Volume group "centos" successfully extended
7.查看当前逻辑卷
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID q9mens-Ujcs-Kgzq-Gbtd-gEdF-D6x7-Oa3GmP
LV Write Access read/write
LV Creation host, time localhost, 2020-01-13 11:17:40 +0800
LV Status available
# open 1
LV Size <99.00 GiB
Current LE 25343
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
8.将“VG Name centos”卷组中的空闲空间扩展到根分区逻辑卷
[root@localhost ~]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from <99.00 GiB (25343 extents) to 198.99 GiB (50942 extents).
Logical volume centos/root successfully resized.
9.刷新根分区
[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=6487808 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=25951232, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=12671, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 25951232 to 52164608

虚拟化下Centos7 扩容根分区的更多相关文章
- virt-manager中为centos 7.2 扩容根分区
1. 打开virt-manager,添加一块磁盘. Add Hardware --> 选中Storage --> Manager (操作参考下图) 点击Manager之后,弹出Choose ...
- Centos7.0根分区扩容
添加一块10G的硬盘 查看磁盘大小 # df -Th 查看物理卷组 # vgdisplay 查看逻辑卷 # lvs 查看磁盘信息 # fdisk -l 对添加的10G硬盘分区 # fdisk /dev ...
- centos 7.4 磁盘空间不足,扩容根分区 --lvm模式
背景:根分区磁盘空间不足,需要扩容root磁盘空间 1.查看现有磁盘信息,可以看出根分区有26G [root@localhost ~]# df -h 2.查看新增加的磁盘信息(改虚拟机已经添加好了,不 ...
- VMware下扩展Ubuntu根分区大小
一.查看磁盘信息 使用df命令用来查看文件系统的磁盘空间占用情况,由下可知我的/dev/sda1分区是挂载在根目录下的,本文目标就是来扩容/dev/sda1分区. 二.下载Gparted工具 Gpar ...
- centos7扩展根分区
参考网站:http://www.360doc.com/content/18/0128/11/52410512_725728162.shtml VirtualBox中安装了CentOS 7,给同事用来做 ...
- LVM扩容根分区
LVM的工作方式 LVM管理工具集 [root@wendang ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda ...
- Linux虚拟机扩容根分区CentOs6.9 VMware14
1.首先关闭虚拟机点击编辑虚拟机设置 2.点击想要扩容的硬盘点击扩容 3.增加容量 输入想增加的容量,因为我本身是30G写到35G是加了5G不是增加30G.(此处为了演示只增加5G) 4.开启虚拟机 ...
- 给虚拟机CentOS7扩容(lvm方式)
虚拟机中centos7原有容量不够了,需要进行扩容. 可以使用图形工具gparted来进行操作,安装和使用可自行百度.但需要注意的是,这篇文章提到:一定要用parted中的mkfs命令格式化分区,用系 ...
- 实战 | Linux根分区扩容
一个执着于技术的公众号 一个执着于技术的公众号 前言 Linux系统作为服务器操作系统,经常遇到一个问题就是服务器分区磁盘空间不足需要扩容的情况.本文以linux系统最常见的发行版centos7系统为 ...
随机推荐
- 基础篇:深入解析JAVA反射机制
目录 反射的概念 获取Class的三种方法 JAVA反射API 反射机制应用的场景 反射和JDK动态代理 欢迎指正文中错误 关注公众号,一起交流 参考文章 反射的概念 java的放射机制:在程序运行时 ...
- 如何自动填充SQL语句中的公共字段
1. 前言 我们在设计数据库的时候一定会带上新增.更新的时间.操作者等审计信息. 之所以带这些信息是因为假如有一天公司的数据库被人为删了,尽管可能有数据库备份可以恢复数据.但是我们仍然需要追踪到这个事 ...
- java调用Oracle中的存储过程与存储函数
1 //调用存储过程 2 public static void testPro(){ 3 String driver = "oracle.jdbc.OracleDriver"; 4 ...
- Hibernate4.3 继承映射
一.单表继承映射 父子类合成一张表 An_id An_name gender Weight Height type 1 dog 1 300 D 2 cat 1 100 C 在Animal.hbm.xm ...
- 图文并茂C++精华总结 复习和进阶
字面常量不可以有引用,因为这也不需要使用符号来引用了,但是字面常量却可以初始化const引用,这将生成一个只读变量: 对变量的const修饰的引用是只读属性的: 也就是说,const修饰的引用,不管是 ...
- Windows 无法验证此设备所需的驱动程序的数字签名”的问题
转载: 1.https://jingyan.baidu.com/article/375c8e19c2b25b25f2a229a3.html 2. https://jingyan.baidu.com/a ...
- C++对话框创建及修改对话框属性
转载:http://www.51testing.com/html/48/n-3151648.html 创建对话框 C++中对话框分为模式对话框和非模式对话框. 模式对话框的创建: MyDialog m ...
- P2652 同花顺
P2652 同花顺 Link 题目背景 所谓同花顺,就是指一些扑克牌,它们花色相同,并且数字连续. 题目描述 现在我手里有 \(n\) 张扑克牌,但它们可能并不能凑成同花顺.我现在想知道,最少更换其中 ...
- vue 组件的封装
封装的原因 首先封装组件的需求肯定是多个地方要用到同一个东西,他们都有公共的地方,vue的封装 简单来说就是将公共参数封装起来 然后在需要的地方引入 //子组件封装 <template> ...
- 三门峡6378.7939(薇)xiaojie:三门峡哪里有xiaomei
三门峡哪里有小姐服务大保健[微信:6378.7939倩儿小妹[三门峡叫小姐服务√o服务微信:6378.7939倩儿小妹[三门峡叫小姐服务][十微信:6378.7939倩儿小妹][三门峡叫小姐包夜服务] ...