Resizing Oracle VirtuaBox VDI on a Mac

Resizing Oracle VirtuaBox VDI on a Mac

Today I needed to increase the size of the VDI file on my Oracle Virtualbox virtual machine.  I run it on a MacBook Pro so I can still use Windows 7, 10, and 2016 as needed for their utilities or testing.

Resizing has to be performed from the mac Terminal (command line).  The syntax is pretty simple, but still there is room for error.

With VirtualBox closed, go to the folder where the VDI is stored and run the command below substituting your filename and size requirements respectively.  NOTE:  there are two dashes before the resize command.

The following example would resize the file to 123,456K  (123.456MB)

VBoxManage modifyhd  “Windows 7 Pro.VDI” — resize 123456

However, I received an error.  “Cannot register the hard disk  because a hard disk  already exists”.  During the course of the error there was a long number in {brackets}.    The key is to copy that number and rerun the command substituting it for your filename as shown below:

VBoxManage modifyhd  {18fd3671-1b4f-49d1-a4bc-40e52bb78051} — resize 123456

Increasing the size could take place nearly instantly on a faster computer, but no error message is a great sign.  A directory listing won’t show an increase in file size as it has not been utilized yet.  Open up VirtualBox and you will be able to see the change under storage properties.

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *