注:适用于未使用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. [web] Get和Post区别,EncType提交数据的格式详解

    转载自:http://www.cnblogs.com/sunxucool/archive/2012/12/11/2813113.html 1. get是从服务器上获取数据,post是向服务器传送数据. ...

  2. Kubernetes环境下如何运行Coherence缓存集群

    Oracle官方出了一个如何在Docker环境下运行Coherence的技术文档,大家可以参考: https://github.com/oracle/docker-images/tree/master ...

  3. iOS:Xcode7下创建 .a静态库 和 .framework静态库

    Xcode7 中创建静态库:.a 和 .framework 一.简单介绍 1.什么是库? 库是程序代码的集合,是共享程序代码的一种方式 2.库的分类 根据源代码的公开情况,库可以分为2种类型 (1)开 ...

  4. JS使用cookie实现DIV提示框只显示一次的方法

    本文实例讲述了JS使用cookie实现DIV提示框只显示一次的方法.分享给大家供大家参考,具体如下: 这里运用JavaScript的cookie技术,控制网页上的提示DIV只显示一次,也就是当用户是第 ...

  5. win7上搭建ruby开发环境

    1. 安装ruby 可使用windows下的ruby安装工具rubyinstaller来方便地安装ruby解释器,可以http://rubyinstaller.org/网站上下载得到.安装时,看清安装 ...

  6. Spark(十一) -- Mllib API编程 线性回归、KMeans、协同过滤演示

    本文测试的Spark版本是1.3.1 在使用Spark的机器学习算法库之前,需要先了解Mllib中几个基础的概念和专门用于机器学习的数据类型 特征向量Vector: Vector的概念是和数学中的向量 ...

  7. 主流浏览器CSS3和HTML5兼容性

    各大主流浏览器对 CSS3 和 HTML5 的支持越来越完善,曾经让多少前端开发人员心碎的IE系也开始拥抱标准.就在前几天,W3C的 HTML5 社区领袖 Shelley 宣布,HTML5的开发工作已 ...

  8. vuex介绍

    Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化.Vuex 也集成到 Vue 的官方调试工具 ...

  9. POJ3264 Balanced Lineup 【线段树】+【单点更新】

    Balanced Lineup Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 32778   Accepted: 15425 ...

  10. poj1113Wall 求凸包周长 Graham扫描法

    #include<iostream> #include<algorithm> #include<cmath> using namespace std; typede ...