由于扩容磁盘的操作非同小可,一旦哪一步出现问题,就会导致分区损坏,数据丢失等一系列严重的问题,因此建议:在进行虚拟机分区扩容之前,一定要备份重要数据文件,并且先在测试机上验证以下步骤,再应用于您的生产机器。如果虚拟机的磁盘不够用了,建议附加新磁盘进行使用,不到万不得已一般不要扩容磁盘分区。

操作系统环境:

[root@hlmc73t ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

1.关闭虚拟机

备注:扩容磁盘需要关闭虚拟机,否则无法调整磁盘的大小

2.调整磁盘的大小(示例中将原来的30GB调整为了150GB)

3.等待跟新完成,启动虚拟机,查看到整块磁盘已经变为150G,但/dev/sda2分区还是30G

4.使用命令:fdisk /dev/sda,重新划分分区/dev/sda2

[root@hlmc73t ~]# fdisk -l /dev/sda

Disk /dev/sda: 161.1 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: 0x000c1fec Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 Linux
[root@hlmc73t ~]# clear
[root@hlmc73t ~]# fdisk /dev/sda
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. Command (m for help): p ##查看目前的分区信息 Disk /dev/sda: 161.1 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: 0x000c1fec Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 1026048 Linux Command (m for help): d ##将原来的/dev/sda2分区删除
Partition number (,, default ):
Partition is deleted Command (m for help): p Disk /dev/sda: 161.1 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: 0x000c1fec Device Boot Start End Blocks Id System
/dev/sda1 * Linux Command (m for help): n ##重新创建分区
Partition type:
p primary ( primary, extended, free)
e extended
Select (default p): p
Partition number (-, default ):
First sector (-, default ): ##该值需要与上述标黄的start值相同
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ):
Using default value
Partition of type Linux and of size 149.5 GiB is set Command (m for help): p Disk /dev/sda: 161.1 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: 0x000c1fec Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 Linux 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 : 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() or kpartx()
Syncing disks.

5.使用fdisk –l查看/dev/sda2已经变为了150G,但使用df –h查看/dev/sda2还是30G

6.此时拉伸文件系统的话,输出信息类似如下,拉伸没有生效。需要重启电脑以便重读分区表后,才能成功拉伸文件系统。备注:可以使用“blkid”命令查看分区的文件系统

7.重启电脑后,重新使用命令:xfs_growfs,拉伸文件系统,可以看到成功拉伸文件系统

8.重新查看,发现/dev/sda2成功拉伸为了150G,并且之前的数据文件仍然存在并可正常使用。

CentOS7.3 ARM虚拟机扩容系统磁盘的更多相关文章

  1. CentOS6.9 ARM虚拟机扩容系统磁盘

    由于扩容磁盘的操作非同小可,一旦哪一步出现问题,就会导致分区损坏,数据丢失等一系列严重的问题,因此建议:在进行虚拟机分区扩容之前,一定要备份重要数据文件,并且先在测试机上验证以下步骤,再应用于您的生产 ...

  2. AzureARM 使用 powershell 扩容系统磁盘大小

    azure中的虚拟机,windows磁盘大小为127G,linux磁盘大小为30G,在很多时候部署应用程序时直接部署到系统磁盘内导致磁盘后期容量不够需要扩容,在执行分区扩容前我们需要先通过Potal或 ...

  3. CentOS7.3托管磁盘虚拟机扩容数据磁盘

    随着托管磁盘的上线,虚拟机支持的单块磁盘容量从1TB到达了4TB,客户对单块磁盘容量的需求量也会变的很大. 操作之前需要重点查看: 由于扩容磁盘的操作非同小可,一旦哪一步出现问题,就会导致分区损坏,数 ...

  4. centos7下使用LVM给系统硬盘扩容超详细

    简单介绍: LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层,来提高磁盘分区管理的 ...

  5. 【转载】CentOS7下使用LVM给系统硬盘扩容

    原文地址:https://www.cnblogs.com/ding2016/p/9680690.html 简单介绍: LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是L ...

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

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

  7. VMware虚拟机扩展Ubuntu系统磁盘空间

    1 首先给虚拟机扩容 虚拟机->设置->硬盘->实用程序->扩展磁盘容量 2 启动Ubuntu系统 2.1 打开终端安装gparted,sudo apt-get install ...

  8. Linux系统扩容根目录磁盘空间

    作者:非法小恋 一.使用背景 Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘,但是发现系统里的大小还是没改变. 产生的原因是没有给磁盘格式化,没有增加分区. 二. ...

  9. Java 创建 ARM 虚拟机磁盘类型选择的问题

    问题描述 在Azure 门户创建 ARM 虚拟机时,我们直接可以选择虚拟机的磁盘类型,但是在 Azure Management Libraries for Java 的 API 中我们无法找到直接设置 ...

随机推荐

  1. QuickStart系列:docker部署之Elasticsearch

    ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,并作为Apach ...

  2. Html5 移动端 触摸滑动事件

    以下代码经过测试  没有问题 且可以循环滑动 <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"& ...

  3. 如何一条sql语句查找表中第二大值

    例1: 一个Customer表,一个字段Value,现请问如何查到Value中第二大的值 select max(value) from Customer where value < (selec ...

  4. Check whether a remote server port is open on Linux

    链接:https://www.pixelstech.net/article/1514049471-Check-whether-a-remote-server-port-is-open-on-Linux

  5. ATM机运行代码

    实现代码: import java.util.Scanner; public class Atm { public static void main(String[] args) { // TODO ...

  6. windows下apache配置虚拟主机

    因为有多个laravel项目需要配置根目录到public下面,所以要配置多个虚拟主机 方法一:添加端口号 第一步:进入apache的目录 Apache24\conf 找到 httpd.conf 文件, ...

  7. cs231n spring 2017 lecture15 Efficient Methods and Hardware for Deep Learning 听课笔记

    1. 深度学习面临的问题: 1)模型越来越大,很难在移动端部署,也很难网络更新. 2)训练时间越来越长,限制了研究人员的产量. 3)耗能太多,硬件成本昂贵. 解决的方法:联合设计算法和硬件. 计算硬件 ...

  8. 栈的存储结构的实现(C/C++实现)

    存档 #include "iostream.h" #include <stdlib.h> #define max 20 typedef char elemtype; # ...

  9. [51nod1671]货物运输

    公元2222年,l国发生了一场战争. 小Y负责领导工人运输物资. 其中有m种物资的运输方案,每种运输方案形如li,ri.表示存在一种货物从li运到ri. 这里有n个城市,第i个城市与第i+1个城市相连 ...

  10. And Then There Was One(约瑟夫问题变形)

    题目链接:http://poj.org/problem?id=3517 And Then There Was One Time Limit: 5000MS   Memory Limit: 65536K ...