From DiLab
Jump to: navigation, search

Get the latest about the VirtualBox (for linux) at

How to resize a disk drive for a virtual machine

Say, you have a 10GB drive for your virtual WindowsXP, but need more space. There are two ways, depending on the format of your virtual disks:

.vdi disk images

  • Detach the disk image from the virtual machine in VirtualBox
  • Run the following from the command line
VBoxManage modifyhd mydisk.vdi --resize <size-in-MB>
  • Reattach the new expanded drive in the VirtualBox

.vmdk disk images

vmdk format is not supported for "--expand" at the moment, but you could get away with cloning it to a bigger image

  • Create a new (larger) disk image in VirtualBox - this will be your new big disk.
  • From the command line:
VBoxManage clonehd myolddisk.vmdk mynewbigdisk.vmdk --existing
  • Detach the old disk and attach the new one to your virtual machine in VirtualBox
  • Go to your guest operating system, and "expand" the current file system to the new bigger disk. You may need a partition manager software such as Aomei Free Partition Magic for Windows XP

Generic VirtualBox install (might be depreciated)

To install VirtualBox virtual machine engine in Ubuntu from the repositories:

sudo apt-get install virtualbox

Then add your user to the virtualbox group.

In case you can not start the Virtual Box machines and get a message that you should install ...modules... package, try sudo apt-get install "the-corresponding-module-package". If you can not find the package in the repository (I could not find virtualbox-ose-modules-2.6.24-25-generic while running 2.6.24-25 Ubuntu kernel version), try the following:

sudo apt-get install virtualbox-ose-source module-assistant
sudo module-assistant auto-install virtualbox-ose-source
sudo /etc/init.d/vboxdrv start

Python2.5 dependency

VirtualBox 4.1 depends on python2.5, however, the latter is no more in Ubuntu 11.04. The solution is to get it like this:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.5

Then do the Virtual box install.