注:适用于未使用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. java获取桌面路径的方法

    FileSystemView fsv = FileSystemView.getFileSystemView(); File com=fsv.getHomeDirectory(); System.out ...

  2. Drupal 7.31 SQL Injection Exp

    #-*- coding:utf-8 -*- import urllib2,sys import hashlib   # Calculate a non-truncated Drupal 7 compa ...

  3. Keen Team

    Keen Team (碁震安全研究团队,KeenTeam)是一支由在信息安全理论和技术研究方面全球领先的中国“白帽”安全专家组成的信息安全研究队伍,成员主要来自微软的安全漏洞研究.安全攻击和防御技术研 ...

  4. Druid对比Hadoop

    Druid对比Hadoop Hadoop 向世界证明, 花费很少的钱实现典型的解决方案, 将数据保存在一般的商用机器的数据仓库里是可行的. 当人们将自己的数据保存在Hadoop, 他们发现两个问题   ...

  5. MySQL数据库分片技术调研

    将这段时间了解的MySQL分片技术和主从复制只是整理清楚画了思维导图记录一下,希望能给需要的人一些帮助 P.S.:个人整理,可能会有错误之处,还望指出~ 要解决的问题 1.海量数据的操作超出单表.单库 ...

  6. 9.11排序与查找(三)——给定一个排序后的数组,包括n个整数,但这个数组已被旋转过多次,找出数组中的某个元素

    /**  * 功能:给定一个排序后的数组.包括n个整数.但这个数组已被旋转过多次,次数不详.找出数组中的某个元素.  * 能够假定数组元素原先是按从小到大的顺序排列的.  */ /** * 思路:数组 ...

  7. SAP query传输以后须要又一次生成程序

    近期有个需求,须要改动一个Query,在DEV改动好并測试通过后.传输到QAS,可是报表还是没变化,着实郁闷了一下,这是万能的google帮上忙了,原来传到其它系统以后还须要generate prog ...

  8. jQuery 获取DOM节点的两种方式

    jQuery中包裹后的DOM对象实际上是一个数组,要获得纯粹的DOM对象可以有两种方式: 1.使用数组索引方式访问,例如: var dom = $(dom)[0]; 如: $("#id&qu ...

  9. 图片懒加载lazyload.js详解

    简介 lazyload.js用于长页面图片的延迟加载,视口外的图片会在窗口滚动到它的位置时再进行加载,这是与预加载相反的. 优点 它可以提高页面加载速度: 在某些情况清晰它也可以帮助减少服务器负载. ...

  10. 执行”spark-shell –master yarn –deploy-mode client”,虚拟内存大小溢出,报错

    在Hadoop 2.7.2集群下执行如下命令: spark-shell  --master yarn --deploy-mode client 爆出下面的错误: org.apache.spark.Sp ...