Convert Dynamically Sized VirtualBox VDI Hard Drive to Fixed Size

The Problem

You have got a dynamically sized, VDI virtual hard drive in VirtualBox and would like to convert it into a fixed size hard drive.

You are using Windows.

The Solution

  • Locate VBoxManage.exe on your machine. It should be in the VirtualBox program directory (usually found under C:\Program Files\Oracle\VirtualBox) .
  • Open a command prompt (e.g. by searching for “cmd”+Enter Windows 7 or 8).
  • Go to the directory in which VBoxManage.exe is located by typing something like:

cd “C:\Program Files\Oracle\VirtualBox”

  • Convert your dynamically sized hard drive to a fixed size harddrive using the command:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd <path-to-source-vdi> <path-to-destination-vdi> –variant Fixed

This might take a while depending on the size of your drive. You probably have used this drive as part of a virtual machine. In order to use the new hard drive you need to go through a few more steps.

  • Open the virtual box manager, go to settings for your machine and remove the old (dynamically sized) drive from the SATA controller for this machine.

  • Go back to the command line and display a list of your currently registered hard drives:

VBoxManage.exe list hdds

  • Manually remove your old drive from the list by running the command:

C:\Program Files\Oracle\VirtualBox>vboxmanage closemedium disk <UUID of your drive> –delete

ATTENTION: This will delete your old hard drive file. You may want to make a backup copy of the image before running this operation.

  • Rename the new (fixed size) hard drive file to the name of your original vdi file. For instance, if your old drive’s name was ‘myhdd-10GB.vdi’ and your new fixed size drive’s name is ‘fixed-10GB.vdi’, rename ‘fixed-10GB.vdi’ to ‘myhdd-10GB.vdi’
  • Go to the VirtualBox Manager and add the freshly renamed drive to the SATA controller for your VM.

Now you should be able to start your VM with the new drive and (hopefully) enjoy the performance benefits of a fixed size drive.


HOWTO: Convert VDIs Between Fixed-Sized and Dynamic In VirtualBox

Stackoverflow – Convert VirtualBox dynamic VDI disk image to static, fixed VDI

coderwall – Purge deleted hard disks from Virtual Box


16 thoughts on “Convert Dynamically Sized VirtualBox VDI Hard Drive to Fixed Size

  1. FYI the command line to remove the old hard drive is:

    C:\Program Files\Oracle\VirtualBox>vboxmanage closemedium disk -–delete

    [Note the ‘–‘]

  2. Hi, thanks a lot for your help.
    I managed to arrive to the last step, but when trying to add the renamed drive to the SATA controller, it gives me the following error:

    “Cannot register the hard disk ‘..\Ubuntu.vdi’ {44025a26-292a-4e29-b58c-50a65b77f9d5} because a hard disk ‘..\Ubuntu_2.vdi’ with UUID {44025a26-292a-4e29-b58c-50a65b77f9d5} already exists.”

    Notice that Ubuntu was the name of the first drive I had, whereas Ubuntu_2 was the name of the fixed one. I renamed Ubuntu_2 in Ubuntu as you said.

    Do you know how to fix this?

    Thank you!

    1. Hi There,

      Thank you for your question.

      Do you have the old hard disk still linked to this virtual machine or another virtual machine? Unlink it from there and the error should disappear!

      Hope it helps!

      1. Hi,

        How can I unlink the old hard disk? Sorry but I am not very handy with this. I am using Windows 10.


      2. Hi! You can try to do it as follows:

        – Select the VM
        – Click on Settings
        – Go to the Storage page
        – Select the hard drive you want to remove/unlink
        – At the bottom of the list, click on the little disk icon with the – sign on it

        Hope this helps!

    1. That is strange! Can you provide the full command you are using? Maybe something is in the wrong order? Or you are missing the “clonehd”?

    1. Just an anecdote here, I’m performing this conversion on a 50GB image, i’m about 30 minutes in and the status is only at 30%. I could see the new image file being created and expanded immediately but even after the new file hit 50GB the progress was still at 0%, so it might seem like it’s not doing anything but it seems to just take some time. It’ll also depend on the speed of your computer and hard disks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s