lfjigu 发表于 2015-10-13 00:44:25

Oracle Virtualbox 增加虚拟磁盘空间

  VirtualBox 4.0 got a very cool new feature that allows you to easily resize a hard disk in just a few seconds. Previously, you had to install Gparted to do this and the procedurewas quite slow.
  
  In VirtualBox 4.0+ (see how to install VirtualBox 4.0.x in Ubuntu), to resize a VirtualBoxhard disk image (.VDI) firstly locate the folder where the .vdi you want to resize is located - this should be under~/VirtualBox VMs or~/.VirtualBox/HardDisks. Then open a terminal, navigate to that folder("cd /FOLDER/PATH") and run the following command to resize the .VDI:
  VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
  
  Where YOUR_HARD_DISK.vdi is the VirtualBox hard disk you want to resize and SIZE_IN_MB is the new virtual hard disk size, in megabytes. For example, the following command will resize the VirtualBox hard disk called "natty.vdi"to 12000 megabytes:
  VBoxManage modifyhd natty.vdi --resize 12000
  
  用Oracle virtualbox安装了虚拟的Linux系统,当时只给虚拟磁盘分配了默认了8G的空间,装了几个软件,空间就不足了,于是今天试着增加虚拟存储空间
  网上搜了下,主要有两种办法
  1, 利用GParted,创建一个新的虚拟磁盘(vdi),给定需要的大小,然后,用Gparted将旧的虚拟磁盘的东西拷到新的上面,然后用新的替换旧的磁盘
  2, 第二种就是,以上所述,简单方便。直接利用vboxmanage这个程序,直接在host上对vdi大小进行调整,这个程序就在virtualbox安装目录下
  D:\app\VirtualBox\fedora>D:\app\VirtualBox\VBoxManage.exe modifyhd fedora.vdi --resize 20000
  0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
  
  D:\app\VirtualBox\fedora>
  Fedora.vid就是我的虚拟机的磁盘文件,执行完后,查看vdi大小,已经变成20GB了
  

  待续...., 因为登陆到Fedora发现,那些未分配的空间,因为上一步,只是增加它的容量,并没有挂载到系统上,下一步,将是处理未分配的空间....
         版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: Oracle Virtualbox 增加虚拟磁盘空间