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

  1. UUID: 297f254e-ada0-4ddd-be61-552226c3df58
  2. Parent UUID: base
  3. State: created
  4. Type: normal (base)
  5. Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65197\centos.vdi
  6. Storage format: VDI
  7. Capacity: MBytes
  8. Encryption: disabled
  9.  
  10. UUID: 840332aa-7efb--b108-cea25b1bded6
  11. Parent UUID: base
  12. State: created
  13. Type: normal (base)
  14. Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65198\CentOS65198-disk1.vdi
  15. Storage format: VDI
  16. Capacity: MBytes
  17. Encryption: disabled
  18.  
  19. UUID: 0e4317e3-2dd1-45f5-82e0-83a4469bf4ab
  20. Parent UUID: base
  21. State: created
  22. Type: normal (base)
  23. Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65199\CentOS65199-disk1.vdi
  24. Storage format: VDI
  25. Capacity: MBytes
  26. Encryption: disabled
  27.  
  28. UUID: 536f5698-b4e0-4d03-bdcc-2450fb802707
  29. Parent UUID: base
  30. State: created
  31. Type: normal (base)
  32. Location: C:\Users\yzkj-\VirtualBox VMs\CentOS65197\newdisk.vdi
  33. Storage format: VDI
  34. Capacity: MBytes
  35. Encryption: disabled

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

3.调整当前硬盘大小

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

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

  1. [root@zendlinux ~]# fdisk /dev/sda
  2.  
  3. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
  4. switch off the mode (command 'c') and change display units to
  5. sectors (command 'u').
  6.  
  7. Command (m for help): n
  8. Command action
  9. e extended
  10. p primary partition (-)
  11. p
  12. Partition number (-):
  13. First cylinder (-, default ):
  14. Using default value
  15. Last cylinder, +cylinders or +size{K,M,G} (-, default ):
  16. Using default value
  17.  
  18. Command (m for help): t
  19. Partition number (-):
  20. Partition does not exist yet!
  21.  
  22. Command (m for help): t
  23. Partition number (-):
  24. Hex code (type L to list codes): 8e
  25. Changed system type of partition to 8e (Linux LVM)
  26.  
  27. Command (m for help): w
  28. The partition table has been altered!
  29.  
  30. Disk /dev/mapper/vg_zendlinux-lv_swap: MB, bytes
  31. heads, sectors/track, cylinders
  32. Units = cylinders of * = bytes
  33. Sector size (logical/physical): bytes / bytes
  34. I/O size (minimum/optimal): bytes / bytes
  35. Disk identifier: 0x00000000
  36.  
  37. [root@zendlinux ~]# fdisk -l /dev/sda
  38.  
  39. Disk /dev/sda: 17.2 GB, bytes
  40. heads, sectors/track, cylinders
  41. Units = cylinders of * = bytes
  42. Sector size (logical/physical): bytes / bytes
  43. I/O size (minimum/optimal): bytes / bytes
  44. Disk identifier: 0x000dc501
  45.  
  46. Device Boot Start End Blocks Id System
  47. /dev/sda1 * Linux
  48. Partition does not end on cylinder boundary.
  49. /dev/sda2 8e Linux LVM
  50. /dev/sda4 8e Linux LVM

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

  1. [root@zendlinux ~]# vgdisplay
  2. --- Volume group ---
  3. VG Name vg_zendlinux
  4. System ID
  5. Format lvm2
  6. Metadata Areas
  7. Metadata Sequence No
  8. VG Access read/write
  9. VG Status resizable
  10. MAX LV
  11. Cur LV
  12. Open LV
  13. Max PV
  14. Cur PV
  15. Act PV
  16. VG Size 7.51 GiB
  17. PE Size 4.00 MiB
  18. Total PE
  19. Alloc PE / Size / 7.51 GiB
  20. Free PE / Size /
  21. VG UUID Ou41cE-HyIM-IrsE-Ga3W-Tmmn-l5RX-sw58Zz

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

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

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

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

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

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

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

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

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

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

完成。看看效果:

  1. [root@zendlinux ~]# lvscan
  2. ACTIVE '/dev/vg_zendlinux/lv_root' [14.70 GiB] inherit
  3. ACTIVE '/dev/vg_zendlinux/lv_swap' [816.00 MiB] inherit
  4. [root@zendlinux ~]# df -h
  5. Filesystem Size Used Avail Use% Mounted on
  6. /dev/mapper/vg_zendlinux-lv_root 15G .8G .9G % /
  7. tmpfs 499M 499M % /dev/shm
  8. /dev/sda1 477M 51M 401M % /boot
  9. 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. 使用 Angular CLI 和 Webpack 分析包尺寸

    使用 Angular CLI 和 Webpack 分析包尺寸 对于 Web app 来说,高性能总是最高优先级,对于 Angular 也不例外.但是随着应用复杂度的不断增长,我们如何才能知道哪些内容打 ...

  2. Python3安装Requests

    安装Requests费了1天的时间,囧.终于还是在官网找到解决方法,可以参考这个http://docs.python-requests.org/en/latest/user/install/#inst ...

  3. word2vec初探(用python简单实现)

    为什么要用这个? 因为看论文和博客的时候很常见,不论是干嘛的,既然这么火,不妨试试. 如何安装 从网上爬数据下来 对数据进行过滤.分词 用word2vec进行近义词查找等操作 完整的工程传到了我的gi ...

  4. python之路——初识函数

    阅读目录 为什么要用函数 函数的定义与调用 函数的返回值 函数的参数 本章小结 返回顶部 为什么要用函数 现在python届发生了一个大事件,len方法突然不能直接用了... 然后现在有一个需求,让你 ...

  5. Lua编写wireshark插件初探——解析Websocket上的MQTT协议

    一.背景 最近在做物联网流量分析时发现, App在使用MQTT协议时往往通过SSL+WebSocket+MQTT这种方式与服务器通信,在使用SSL中间人截获数据后,Wireshark不能自动解析出MQ ...

  6. 通过wget工具下载指定文件中的URLs对应的资源并保存到指定的本地目录中去并进行文件完整性与可靠性校验

    创建URLs文件在终端输入cd target_directory回车,便把当前文件夹切换到了目标文件夹target_directory,此后创建的文件都会丢它里面在终端输入cat > URLs回 ...

  7. MySQL基础操/下

    MySQL基础操 一.自增补充 desc (表名)t1: 查看表格信息内容 表的信息 show create table t1(表名):也是查看信息,还不多是横向查看 show create tabl ...

  8. 初试valgrind内存调试工具

    虽然GDB调试工具功能强大,但对于平时做题调试的使用并不方便,这里尝试学习使用比较简单的valgrind工具 Valgrind是一个提供程序调试及性能分析的工具集.其包含的工具主要有Memcheck, ...

  9. 05、NetCore2.0依赖注入(DI)之Web应用启动流程管理

    05.NetCore2.0依赖注入(DI)之Web应用启动流程管理 在一个Asp.net core 2.0 Web应用程序中,启动过程都做了些什么?NetCore2.0的依赖注入(DI)框架是如何管理 ...

  10. flask 操作mysql的两种方式-sqlalchemy操作

    flask 操作mysql的两种方式-sqlalchemy操作 二.ORM sqlalchemy操作 #coding=utf-8 # model.py from app import db class ...