VirtualBox - command line¶
In VirtualBox not all parameters can be changed from the graphical interface. Some part is changed using the command line.
Change the size of the hard disk
The virtual machine’s hard disk is usually located in ~/VirtualBox directories, then the name of the virtual machine or ~/.VirtualBox/HardDisks
Resizing is possible only for a disk in VDI format.
Resize hard disk¶
Is performed with the command:
VBoxManage modifyhd Your_disk.vdi –resize size_in_Mb
The full path to the disk must be specified. In the current 5th version of VirtualBox (command tool VBoxManage), the modifyhd command has been replaced by modifymedium.
For example, if you want to set the disk size to 12000 Megabytes (12 GB) then run:
VBoxManage modifyhd natty.vdi –resize 12000
Change the amount of RAM¶
Go to the directory C\:ProgramFiles\Oracle\Virtualbox and run command:
VBoxManage modifyvm «machine_name» –memory 4000
The size of the RAM is specified in megabytes, it allows you to set the virtual machine memory larger than there is on a real machine.
After setting the amount of memory exceeding that on the host machine, you will not be able to edit the properties of the machine in the graphical interface.
Change OS name¶
The OS name is changed with a command of this type:
VboxManage modifyvm «current_name» –name NEW_NAME
Quotation characters in the new computer name are optional.
Convert VMWare vmdk image to VirtualBox vdi¶
You can convert virtual machine image from VMWare format (vmdk) to VirtualBox format (vdi). This method allows you launch a virtual machine created in VMWare on a workstation with VirtualBox installed.
We require the desktop version of Oracle VirtualBox. Copy vmdk files to the local hard drive, run command line interface as administrator and go to the directory containing VirtualBox:
cd c: \Program Files\Oracle\VirtualBox\
Then launch embedded VBoxManage tool with clonehd parameter to create a copy of virtual machine file and convert it from VMDK to VDI.
Before starting the conversion you should delete snapshot of the virtual machine and make sure that the disk is not used by any running virtual machines.
VBoxManage clonehd --format VDI D:\clonation\PROJECT.virtual.vmdk D:\Virtual.vdi
Now you can create a new virtual machine on VirtualBox and connect the created vdi disk to it. The converted disk will be placed in the root of D:\