How to increase the size of a virtual box VM

Kasun Siyambalapitiya
2 min readMar 18, 2018
Image Source: https://pixabay.com/illustrations/box-amazon-box-package-amazon-5910208/

There may be times that you have created a VM in Oracle Virtual Box with less space and while setting up the environment to the state needed, you get a requirement to expand the size of hard disk with out losing its content. Most probably at this point in time creating a new VM with space and bringing it upto the current state of the previous is time consuming and tedious.

But by following below instructions you will be able to expand the size of current VM within seconds without affecting it content.

  • First stop the current VM instance
  • Then navigate to current VM’s Settings -> Storage section under which you will be seeing the devices allocated for your VM
  • Next delete the current storage device by keeping in mind where it is located as given in the Information section at right.
  • For increasing the size of VM please follow the instructions appropriate for your Operating System below.

For Linux :

  • Open up a terminal and run the following command
~$vboxmanage modifymedium /location/to/the/storage/file/which/needs/to/be/expanded --resize amount_in_MBs

Sample command will be look like below

~$vboxmanage modifymedium /home/kasun/VirtualBox\ VMs/Windows\ 7/Windows 7.vdi/ --resize 40000

For Windows :

  • Navigate to the directory where Oracle Virtual Box is installed via theFile Explorer
  • For opening up a terminal from the same location, obtain the context menu by right clicking on the empty space with holding shift key and then select open command window here
  • Next run the following command
C: \Program File\Oracle\VirtualBox>VBoxManage.exe modifymedium "location\to\the\storage\file\which\needs\to\be\expanded" --resize amount_in_MBs

Sample command will be look like the following

C: \Program File\Oracle\VirtualBox>VBoxManage.exe modifymedium "location\to\the\storage\file\which\needs\to\be\expanded" --resize 40000

Upon running above the size of the disk will be increased. Next for setting up the same storage file ( vdi ) for your VM follow the below instructions

  • Next navigate to the Settings -> Storage window of the current VM again and add the expanded storage.
  • Next start the VM. The newly added amount will be available as anUnallocated space in the Storage settings of the operating system which your VM is running.
  • Finally expand the disk to append it with the formed Unallocated space.

--

--