Need more space for your virtual box? No problem right? 


It was pretty easy to find the command to resize my .vid file:
    VBoxManage modifyhd [VDI] --resize [megabytes]

Problem 1: VBoxManage

If you are using windows using this command word for word will not work. Instead you have to specify the full path for VBoxManage:
    “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd [VDI] --resize [megabytes]
Note1: you will need the quotations so it can understand the space in the folder name.
Note2: you will need to specify the full path of your VDI or cd to its directory


So you successfully execute the command but get the following error:
    Progress state: VBOX_E_NOT_SUPPORTED
    VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

“Turns out you’re not alone. I had this very annoying error message when I was trying to resize a VirtualBox virtual drive”. “I wasn’t really sure what VirtualBox was referencing. Turns out it’s the VirtualBox drive type that isn’t supported. More specifically, VirtualBox does not support resizing a fixed-size virtual disk. Therefore, you can only resize a dynamically-resizing virtual drive. There is a quick solution if you don’t mind the new drive being dynamic. Turns out that VirtualBox’s virtual drive cloning tool will take your fixed-size virtual drive and when cloning, create you a copy but as a dynamic drive.”

    VBoxManage clonehd [mydrive.vdi] [newdrive.vdi]
    VBoxManage modifyhd –resize [megabytes] [newdrive.vdi]

Problem 3: Still not Dynamic?

However, when I followed those steps I was confronted with the same VBOX_E_NOT_SUPPORTED error… I decided to refine the clonehd command, adding the “–variant standard” option and then trying modifyhd:

    VBoxManage clonehd [mydrive.vdi] [newdrive.vdi] –variant Standard

No dice. Time to try a new plan of attack…

    VBoxManage createhd –size [megabytes] –filename [newdrive.vdi] –variant Standard
    VBoxManage clonehd [mydrive.vdi] [newdrive.vdi] –existing

    VBoxManage modifyhd –resize [megabytes] [newdrive.vdi]
Now open up VirtualBox and go to the storage settings. Remove the existing SATA controller and add the one we have created:

Problem 4: Still no Free Space!

Everything seemed to work fine, but where has that extra space gone? My Guest system is Mate so looking at its drive using GParted gives us the answer:

The extra space has been unallocated: the command only changed the logical size – we need to extend the partition to use the free space. Unfortunately you can’t move or resize the drive now as the partitions are in use. To solve this I will use the GParted Live CD. Once you have downloaded the .iso image mount onto your virtual machine:

You might also want to ensure that the virtual systems boot order is set correctly:

When you start your system you should now be greeted by GParted:

Run through the options (I selected don’t touch and then 02 for english). Once at the terminal use startx to access the GUI:

You can now manipulate the partitions. The first thing we need to do is move the swap partition. To do this we need to remember its size, deleate it and then recreate it.

  1. Write down the size of the extended -> linux-swap partition
  2. Delete the linux-swap partition
  3. Delete the extended partition

You can now expand /dev/sda1, but leave some space at the end to recreate the linux-swap:

Recreate the extended partition:

And then recreate the linux swap:

Apply the changes and shutdown. The disk should automatically be removed from the virtual drive. Start up your virtual system and if all went well your primary partition should be expanded!