注:适用于未使用lvm管理的分区,目前仅在CentOS 6.5 上操作,其他系统尚未测试,请谨慎操作

一、查看当前分区状况

[root@disk-test ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        26G  2.3G   22G  10% /

tmpfs           1.9G     0  1.9G   0% /dev/shm

/dev/sda1       194M   34M  151M  19% /boot

---------------------------------------------------------------------------

二、控制台调增虚拟机磁盘

关闭系统,在控制台调增虚拟机磁盘大小为50G,重启系统

[root@disk-test ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000cea7e

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26         548     4194304   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/sda3             548        3917    27057152   83  Linux                          #注意这里起始cylinder 是548,起始cylinder 绝对不可以改,这样会破坏原分区的数据。

---------------------------------------------------------------------

三、扩展根分区/dev/sda

[root@sjsa-disk-test ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').

Command (m for help): m

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibility flag

d   delete a partition

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)

Command (m for help): p

Disk /dev/sda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000cea7e

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26         548     4194304   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/sda3             548        3917    27057152   83  Linux

Command (m for help): d

Partition number (1-4): 3                                               #根/分区是多少就输入几,这里是/dev/sda3

Command (m for help): p

Disk /dev/sda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000cea7e

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26         548     4194304   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 3                                             #之前是多少,这里还输入多少

First cylinder (548-6527, default 548):

Using default value 548

Last cylinder, +cylinders or +size{K,M,G} (548-6527, default 6527):                         #由之前3917,扩为6527

Using default value 6527

Command (m for help): p

Disk /dev/sda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000cea7e

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      204800   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              26         548     4194304   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/sda3             548        6527    48027999+  83  Linux                                      #变成了6527

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@sjsa-disk-test ~]# reboot

执行如下命令,完成根分区扩充

[root@sjsa-disk-test ~]# resize2fs /dev/sda3

resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/sda3 is mounted on /; on-line resizing required

old desc_blocks = 2, new_desc_blocks = 3

Performing an on-line resize of /dev/sda3 to 12006999 (4k) blocks.

The filesystem on /dev/sda3 is now 12006999 blocks long.

四、验证

查看当前磁盘状态

[root@sjsa-disk-test ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        46G  2.3G   41G   6% /

tmpfs           1.9G     0  1.9G   0% /dev/shm

/dev/sda1       194M   34M  151M  19% /boot

如上,完成对根分区的扩充

Vmware私有云虚拟机(CentOS 6.5 OS)之根分区扩容的更多相关文章

  1. CentOS下调整home和根分区大小

    由于我们有时候没法预估或者说错误的盘符分区的时候,常常会导致我们后面的操作出现极大的不方便,这里我就记录下一个错误分区后对home和根分区存储空间大小调整的整个过程! ①查看我们现有机器的分区状况 c ...

  2. 解决linux系统CentOS下调整home和根分区大小

    目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root   1.首先查看磁盘使用情况 [root@localhost ~]# df -h 文件系统 ...

  3. CentOS下调整home和根分区大小的方法

    解决外挂硬盘的问题. 目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root 1.首先查看磁盘使用情况[root@jb51.net~]# df -h ...

  4. 解决linux系统CentOS下调整home和根分区大小《转》

    转自http://www.php114.net/2013/1019/637.html 目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root   1 ...

  5. 安装vmware和装虚拟机

    今日任务 .Linux发行版的选择 .vmware创建一个虚拟机(centos) .安装配置centos7 .xshell配置连接虚拟机(centos) 选择性 pc可以选择 -纯系统 Linux/w ...

  6. 私有云的迁移:从VMware到OpenStack

    VMware和OpenStack经常被描述为相互竞争的两种私有云技术.虽然这两种技术其实可以互补,但一些组织却选择从VMware迁移到OpenStack的私有云上. 让我们来看看这些组织如何能同时使用 ...

  7. VMware创建Linux虚拟机并安装CentOS(一)

    在VMware中新建虚拟机,在新建虚拟机向导中,选择“自定义(高级)”选项,鼠标单击“继续”按钮 选择VMware的版本workstation9.0(VMware版本对硬盘.内存.cpu等硬件的支持大 ...

  8. VMware与宿敌Amazon一笑泯恩仇:重新定义混合云?(私有云节节败退)

    摘要: 私有云巨头VMware看来是真的要输给一个“书贩子” 了!这意味着私有云将败给公有云? [阅读原文] 三年前,虚拟化巨头VMware曾对亚马逊Amazon云服务AWS竖过中指:我们怎么可能打不 ...

  9. OpenStack(企业私有云)万里长征第六步——OpenStack网络及虚拟机存储位置

    一.前言 昨天又装了一遍OpenStack.码农这项工作就如同人生,永远有你想不到的意外在等着你,时而是惊喜时而是悲伤.在装的过程中倒是很顺利,只是在安装完成之后碰到了两个之前没有碰到的问题,这里记录 ...

随机推荐

  1. c++之list学习

    #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <list> using namespace std; ...

  2. cdev结构体及其相关函数

    一.在Linux2.6内核中一个字符设备用cdev结构来描述,其定义如下: struct cdev { struct kobject kobj; struct module *owner; //所属模 ...

  3. javascriptMVC框架面向对象编程

    //抽象形状类 $.Class("Shape", {}, { //构造函数 init : function(edge) { this.edge = edge; }, //实例方法 ...

  4. Spark Streaming揭秘 Day2-五大核心特征

    Spark Streaming揭秘 Day2 五大核心特征 引子 书接上回,Streaming更像Spark上的一个应用程序,会有多个Job的配合,是最复杂的Spark应用程序.让我们先从特征角度进行 ...

  5. RGB颜色工具大全 and 网页配色方案

    RGB颜色工具:http://www.ostools.net/commons?type=3 配色方案:http://www.wzsky.net/html/Website/Color/103380.ht ...

  6. 手机SD卡损坏补救措施

    现在的应用程序越来越重,比如微信.来往之类的,稍微用一段时间,就会占用几十MB甚至上百MB的空间.而有时候甚至手机会出现"无响应"的现象,需要你选择"继续等待" ...

  7. JavaScript——中的prototype(原型)

    JS中的prototype是JS中比较难理解的一个部分 本文基于下面几个知识点: 1 原型法设计模式 在.Net中可以使用clone()来实现原型法 原型法的主要思想是,现在有1个类A,我想要创建一个 ...

  8. 在VS2013 IIS Express 添加MIME映射

    打开VS2013返回json提示MIME映射问题 1.在DOS窗口下进入IIS Express安装目录,默认是C:\Program Files\IIS Express,cmd  命令行cd 到 该目录 ...

  9. WSDL接口数据传递以及外网发布需要注意的地方

    A系统传递数据给B系统 1.A创建asmx推送接口如下 using System; using System.Collection.Generic; using System.Data; using ...

  10. Docker 安装docker-compose多容器管理服务

    原文地址:https://github.com/eacdy/spring-cloud-book/blob/master/3%20%E4%BD%BF%E7%94%A8Docker%E6%9E%84%E5 ...