注:适用于未使用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. 简单php连接数据库作操作

    1.近期稳定版本 <?php header('Content-Type: application/json'); $output = []; $host = ''; //MySQL服务器地址 $ ...

  2. JavaWeb过滤器验证登录(避免未经登录进入主页)

    今天用ssh2写了个简单的系统,发现了一个问题,我这系统必须先登录成功才能进入主页,但我在浏览器里直接输入主页地址,发现也能进入,这个肯定不好,毫无安全性可言,后经查资料发现需要登录过滤器,就试了下, ...

  3. CSDN个人空间、问答频道停站维护公告

    各位亲爱的用户:          CSDN个人空间.问答频道将于2014年11月17日18点至11月17日24点进行系统维护升级,升级期间会影响大家的正常訪问和操作.给大家带来不便.敬请广大用户谅解 ...

  4. MPTCP 源码分析(四) 发送和接收数据

    简述:      MPTCP在发送数据方面和TCP的区别是可以从多条路径中选择一条 路径来发送数据.MPTCP在接收数据方面与TCP的区别是子路径对无序包 进行重排后,MPTCP的mpcb需要多所有子 ...

  5. Invalid code signing entitlements. Your application bundle's signature contains

    http://code4app.com/requirement/54128041933bf0e0308b5204 Invalid code signing entitlements. Your app ...

  6. EChart-Timeline

    timeline-day.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  7. linux 系统下MySQL5.7重置root密码(完整版,含ERROR 1820 (HY000)解决方案)

    mysql的root密码忘记了怎么重置? 往下看: 1.保证你的mysql服务处于关闭状态.(用ps -ef | grep mysql 查看进程,有则kill -9 进程号) 2.在my.cnf所在目 ...

  8. unity, 由于project settings中time scale变成0导致动画不播放

    在Mac和iOS间多次switch platform之后,忽然发现开始scene的动画不播了.进入游戏后再切回来动画恢复正常. 检查了scene的逻辑,发现没有任何问题.删除了Temp和Library ...

  9. Atitit.自定义jdbc驱动  支持jsql

    Atitit.自定义jdbc驱动  支持jsql 1. 为什么需要自定义驱动1 1.1. 透明分库分表1 1.2. 自定义数据库的接口.比如大数据文档文件类型的数据库,数据存储引擎2 2. 整个文章分 ...

  10. 基于dsp_builder的算法在FPGA上的实现

    基于dsp_builder的算法在FPGA上的实现   一.摘要 结合dsp_builder.matlab.modelsim和quartus ii等软件完成算法的FPGA实现. 二.实验平台 硬件平台 ...