1.首先获取要扩容的虚拟机的 UUID
VBoxManage 改命令在C:\Program Files\Oracle\VirtualBox目录内,可先添加该目录到环境变量。
C:\Users\yzkj-1008\VirtualBox VMs\CentOS65197>VBoxManage list hdds

UUID:           297f254e-ada0-4ddd-be61-552226c3df58
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65197\centos.vdi
Storage format: VDI
Capacity: MBytes
Encryption: disabled UUID: 840332aa-7efb--b108-cea25b1bded6
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65198\CentOS65198-disk1.vdi
Storage format: VDI
Capacity: MBytes
Encryption: disabled UUID: 0e4317e3-2dd1-45f5-82e0-83a4469bf4ab
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65199\CentOS65199-disk1.vdi
Storage format: VDI
Capacity: MBytes
Encryption: disabled UUID: 536f5698-b4e0-4d03-bdcc-2450fb802707
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65197\newdisk.vdi
Storage format: VDI
Capacity: MBytes
Encryption: disabled

2.虚拟机磁盘扩容
C:\Users\yzkj-1008\VirtualBox VMs\CentOS65197>VBoxManage modifyhd 297f254e-ada0-4ddd-be61-552226c3df58 --resize 16384

3.调整当前硬盘大小

[root@zendlinux ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_zendlinux-lv_root .5G .8G .5G % /
tmpfs 499M 499M % /dev/shm
/dev/sda1 477M 51M 401M % /boot
workspace 22G .4G 16G % /mnt/www [root@zendlinux ~]# fdisk -l Disk /dev/sda: 17.2 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000dc501 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM Disk /dev/mapper/vg_zendlinux-lv_root: MB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000

把容量从6.5扩容到17.2G 单还不能使用
将空余磁盘创建为 sda4

[root@zendlinux ~]# 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): n
Command action
e extended
p primary partition (-)
p
Partition number (-):
First cylinder (-, default ):
Using default value
Last cylinder, +cylinders or +size{K,M,G} (-, default ):
Using default value Command (m for help): t
Partition number (-):
Partition does not exist yet! Command (m for help): t
Partition number (-):
Hex code (type L to list codes): 8e
Changed system type of partition to 8e (Linux LVM) Command (m for help): w
The partition table has been altered! Disk /dev/mapper/vg_zendlinux-lv_swap: MB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000 [root@zendlinux ~]# fdisk -l /dev/sda Disk /dev/sda: 17.2 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000dc501 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM
/dev/sda4 8e Linux LVM

调整 LVM 大小先看看当前 Volume Group:

[root@zendlinux ~]# vgdisplay
--- Volume group ---
VG Name vg_zendlinux
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 7.51 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 7.51 GiB
Free PE / Size /
VG UUID Ou41cE-HyIM-IrsE-Ga3W-Tmmn-l5RX-sw58Zz

名称为 vg_zendlinux,可调整大小(resizable),当前大小为7.51 GB。
活动的 LVM 卷有

[root@zendlinux ~]# lvscan
ACTIVE '/dev/vg_zendlinux/lv_root' [6.71 GiB] inherit
ACTIVE '/dev/vg_zendlinux/lv_swap' [816.00 MiB] inherit

先将分配过来的新磁盘空间创建为一个新的物理卷

[root@zendlinux ~]# pvcreate /dev/sda4
dev_is_mpath: failed to get device for :
Physical volume "/dev/sda4" successfully created

然后使用新的物理卷来扩展 LVM 的vg_zendlinux

[root@zendlinux ~]# vgextend vg_zendlinux /dev/sda4
Volume group "vg_zendlinux" successfully extended

然后扩展 LVM 的逻辑卷 vg_zendlinux/lv_root

[root@zendlinux ~]# lvextend /dev/vg_zendlinux/lv_root /dev/sda4
Extending logical volume lv_root to 14.70 GiB
Logical volume lv_root successfully resized

最后,调整逻辑卷文件系统的大小

[root@zendlinux ~]# resize2fs /dev/vg_zendlinux/lv_root
resize2fs 1.41. (-May-)
Filesystem at /dev/vg_zendlinux/lv_root is mounted on /; on-line resizing required
old desc_blocks = , new_desc_blocks =
Performing an on-line resize of /dev/vg_zendlinux/lv_root to (4k) blocks.
The filesystem on /dev/vg_zendlinux/lv_root is now blocks long.

完成。看看效果:

[root@zendlinux ~]# lvscan
ACTIVE '/dev/vg_zendlinux/lv_root' [14.70 GiB] inherit
ACTIVE '/dev/vg_zendlinux/lv_swap' [816.00 MiB] inherit
[root@zendlinux ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_zendlinux-lv_root 15G .8G .9G % /
tmpfs 499M 499M % /dev/shm
/dev/sda1 477M 51M 401M % /boot
workspace 22G .4G 16G % /mnt/www

Oracle VM VirtualBox虚拟机内Linux系统硬盘扩容步骤(CentOS6.5)的更多相关文章

  1. Oracle VM VirtualBox虚拟机导出教程

    Oracle VM VirtualBox虚拟机导出教程 | 浏览:583 | 更新:2015-01-31 11:21 1 2 3 4 5 6 7 分步阅读 有时我们需要把Oracle VM Virtu ...

  2. VirtualBox虚拟机内的系统时间无法调整的解决方法

    VirtualBox虚拟机内的系统时间无法调整的解决方法   因试用某软件要求将系统时间设置在特定的日期,利用windows自带的调整日期/时间功能进行设置,发现过几秒钟就又恢复到和主机相同的时间了, ...

  3. genymotion+Oracle VM VirtualBox + eclipse + appium 脚本运行慢解决步骤

    genymotion+Oracle VM VirtualBox + eclipse + appium 脚本运行慢解决步骤 1.lenove 机器启动时按F1 进入bios 设置,设置cpu virtu ...

  4. Linux系统硬盘扩容

    参考教程:https://www.jb51.net/article/144291.htm 1.查看硬盘已经用了99% $ df -h #查看硬盘已经使用了99% 文件系统 容量 已用 可用 已用% 挂 ...

  5. Oracle VM VirtualBox虚拟机安装系统

    作为一个前端,必须要有自己的虚拟机,用于测试 IE6 .IE7浏览器. 要测试这两个浏览器,必须要是 Windows XP 系统才可以,这里我找到两个纯净版的 xp 系统 iso 镜像文件. http ...

  6. vm virtualBox下 centos7 Linux系统 与本地 window 系统 网络连接 配置

    由于要模拟生产环境开发,所以要在自己的电脑上安装虚拟机,这里做一下记录. centos与本机网络连接 1. 环境 虚拟机 VirtualBox-5.2.0-118431-Win Linux镜像 Cen ...

  7. Oracle VM VirtualBox 虚拟机与主机共享文件

    安装增强功能(参考文档) VirtualBox自带了一个增强工具Sun VirtualBox Guest Additions,这是实现虚拟机与真实主机共享的关键.启动虚拟机后,点击控制菜单“设备”→“ ...

  8. [转]Oracle VM VirtualBox虚拟机,Ubuntu虚拟机共享文件夹

    VirtualBox的菜单里选择"设备" -> "安装增强功能...". "设备" -> "共享文档夹",添 ...

  9. Oracle VM VirtualBox虚拟机安装Ubuntu Server

    安装过程如下:原文转自:http://www.linuxidc.com/Linux/2012-04/59368p8.htm

随机推荐

  1. 说说cglib动态代理

    前言 jdk中的动态代理通过反射类Proxy和InvocationHandler回调接口实现,要求委托类必须实现一个接口,只能对该类接口中定义的方法实现代理,这在实际编程中有一定的局限性. cglib ...

  2. codeforces 798c Mike And Gcd Problem

    题意: 给出一个数列,现在有一种操作,可以任何一个a[i],用a[i] – a[i+1]和a[i]+a[i+1]替代a[i]和a[i+1]. 问现在需要最少多少次操作,使得整个数列的gcd大于1. 思 ...

  3. angularJs-route路由详解

    本篇基于ng-route来讲下angular中的路由,路由功能主要是 $routeProvider服务 与 ng-view 实现. ng-view的实现原理,是根据路由的切换,动态编译html模板-- ...

  4. eclipse导包导不进来

    今天某个类转移了位置,结果导包导不进来: 解决方法:1.查看本项目中pom的依赖关系,查看是否引用了转移后的项目. 2.查看导不进来的报错类,查看类刚开始import的信息,如果有报错,删除后重新导包 ...

  5. WPF 自定义TabControl控件样式

    一.前言 程序中经常会用到TabControl控件,默认的控件样式很普通.而且样式或功能不一定符合我们的要求.比如:我们需要TabControl的标题能够居中.或平均分布:或者我们希望TabContr ...

  6. 0312-css样式(选择器、文本text、字体fonts、背景background)

    问题: 1.css中table{border:1px:}是定义table的样式,只有表格的外边框,不能实现<table border="1"></table> ...

  7. spring copy中的一个很气人的问题(初学者渣渣的一些感受)

    把别人的工程直接导入使用,出现了各种bug......(细节决定成败,得到以下教训) 1.工程的第一步是检查版本和插件版本兼容问题.很重要 2.然后导入包,看依赖包是否版本太低,(前期做好这些,能让你 ...

  8. 将 Net 项目升级 Core项目经验:(一)迁移Net项目为Net Core\Standard项目

    迁移Net项目为Net Core\Standard项目 背景: 我们公司内部有自己ORM开发框架,最新因为需要将系统迁移到国产服务器上,所以首先需要将最基础的ORM框架改造可以运行在国产服务器上.对于 ...

  9. [HNOI 2011]数矩形

    Description 题库链接 给出平面上 \(n\) 个点,选出四个点作为矩形顶点.求出矩形最大面积. \(1\leq n\leq 1500\) Solution 转载自 Z-Y-Y-S dark ...

  10. [HNOI 2014]世界树

    Description 题库链接 给出一棵 \(n\) 个节点的树, \(q\) 次询问,每次给出 \(k\) 个关键点.树上所有的点会被最靠近的关键点管辖,若距离相等则选编号最小的那个.求每个关键点 ...