How To Resize VirtualBox VDI Disk (Windows)

Recently I started using VirtualBox in order to install and run multiple operating systems on my laptop for testing purposes.

What is VirtualBox:

Oracle VM VirtualBox is a cross-platform virtualization application. What does that mean? For one thing, it installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac OS X, Linux, or Oracle Solaris operating systems (OSes). Secondly, it extends the capabilities of your existing computer so that it can run multiple OSes, inside multiple virtual machines, at the same time. (source)

When you first install VirtualBox, it creates a virtual disk for your new operating systems to use. Sometimes the disk is not big enough and you’ll find yourself trying to resize the disk.

How to Resize VDI Disk

The process contains 2 parts:

A. Resize the VDI file

B. Resize the partition

A. Resize the VDI file

  1. Shutdown VirtualBox.
  2. Open Command Line (CMD) with administrator privileges.
  3. CD to the location of the VDI file (in my case it’s C:\Users\Shay\VirtualBox VMs\Windows7)
  4. VirtualBox contains a command line tool called “VBoxManage.exe”. Locate it (in my case C:\Program Files\Oracle\VirtualBox\VBoxManage.exe) and copy the full path to it.
  5. While in the folder where the VDI file is, type the following:
  6. “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd yourvdifilename.vdi –resize 25000
  7. 25000 represents 25GB. Use 50000 for 50GB etc.
  8. The result should look like this: 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%

B. Resize the partition

Now that we resized the VDI file, we need to resize the partition. Otherwise the extra space would simply be “unused space” or “unallocated space”.

  1. In order to resize the partition, we need to work with a partition editor / manager. We will use Gparted live. GParted is a free partition manager that enables you to resize, copy, and move partitions without data loss.
  2. Download GParted Live here:
  3. While downloading, go back to VirtualBox, and create a new virtual machine.
  4. Call the new machine “Gparted Live”, and choose the type “Linux 2.6 / 3.x / 4.x”.
  5. Do not add hard drive to this machine.
  6. Now we need to attach the Gparted Live Iso file we downloaded in step 2.
  7. Go to the settings of the newly created Gparted Live machine. On the left sidebar, go to storage.
  8. Under “Controller: IDE” add a new optical drive. Choose the Gparted Live iso you downloaded in step 2.
  9. The next step is to add the disk that you want to resize under the “Controller: SATA” section.
  10. Hit ok and start the Gparted Live machine.
  11. Screen: choose “Gparted Live (Default Settings).
  12. Screen: choose “Don’t touch keymap”.
  13. Screen: hit enter to choose English (number 33).
  14. Screen: choose “(0) – continue to start X to use Gparted automatically”.
  15. Now choose the partition you’d like to resize, choose the size you’d like to allocated and hit apply.

Watch this video to get some more info:

Share this post