注:适用于未使用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. Android2017进阶知识点、面试题及答案(精选版)

    前言 没啥好说的,撸起袖子就是干吧! 1 2 JAVA 相关 1.静态内部类.内部类.匿名内部类,为什么内部类会持有外部类的引用?持有的引用是this?还是其它? 静态内部类:使用static修饰的内 ...

  2. pomise的简单用法

    1.then的基本简单用法,当异步获取完数据后就会自动执行then的方法 function runAsync1(){ var p = new Promise(function(resolve, rej ...

  3. Plplot中line width 问题

    Plplot延续了Pgplot的设计风格,线的宽度函数plwid(int width)只能用整型变量,不能精确控制线宽.用pscairo画出的曲线总是太粗,这是plplot一个很老的问题(issue) ...

  4. 删除cnpm

    cnpm是npm的中国镜像:这是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步. 安装:npm install -g cnp ...

  5. 使用iozone测试磁盘性能(测试文件读写)

    IOzone是一个文件系统测试基准工具.可以测试不同的操作系统中文件系统的读写性能.可以通过 write, re-write, read, re-read, random read, random w ...

  6. pip安装mysql报错 ld: library not found for -lssl

    ld: library not found for -lssl clang: error: linker command failed with exit code (use -v to see in ...

  7. ArcGIS Engine读取GDB中的Shape

    string gdbPath = @"D:\Documents\ArcGIS\Default.gdb"; FileGDBWorkspaceFactoryClass pFileGDB ...

  8. redux-actions

    其作用都是用来简化action.reducer. 1.安装 npm install --save redux-actions // 或 yarn add redux-actions 2.使用 crea ...

  9. C++常考面试题汇总(持续更新中)

    c++面试题 一 用简洁的语言描述 c++ 在 c 语言的基础上开发的一种面向对象编程的语言: 应用广泛: 支持多种编程范式,面向对象编程,泛型编程,和过程化编程:广泛应用于系统开发,引擎开发:支持类 ...

  10. WP8简单的计算器

    <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinition ...