Long time VirtualBox users will know that VirtualBox doesn’t support resizing virtual hard drive via its settings. In one of our earlier posts, we discussed how to increase VirtualBox’s disk size in Windows using Command Prompt. The method is useful if your virtual hard drive is running out of space.
While trying to resize VirtualBox’s disk size via Command Prompt, you might get “Resize hard disk operation for this format is not implemented yet!” error. It turns out that the error appears if the installed version of VirtualBox doesn’t support resizing feature (version 4.0 and above support this feature), or if the VirtualBox’s disk size is fixed (fixed size virtual hard drive).
The guide helps you create a clone of the existing virtual hard drive via Command Prompt, increase the size of the clone drive, and then attach the newly created virtual hard to your virtual machine. When you clone a virtual hard drive using the command line tool, it creates dynamically allocated virtual hard drive, meaning, you can easily increase the size virtual hard drive without any errors.
Step 1: Figure out the exact location of VirtualBox’s virtual hard drive and make sure that the drive where VirtualBox’s virtual hard drive is located has enough free space to create clone of the drive.
For instance, if the current size of virtual hard drive located in “D” drive is 20 GB and you would like to expand it to 30 GB, then you must have at least 30 GB free space (20 GB to create clone drive and another 10 GB to increase the size to 30 GB) on your “D” drive.
Step 2: Open Command Prompt. To do this you can type CMD in Start menu search box or Start screen and press Enter key (you don’t need to open elevated prompt). Command Prompt can also be launched by typing CMD in Run dialog box (use Windows logo + R to open Run dialog) and pressing Enter key.
Step 3: In the Command Prompt, type the following command and press Enter key:
cd C:\Program Files\Oracle\VirtualBox
In the above command, replace “C” with the drive letter of your Windows drive.
Step 4: Enter the following command and press Enter key to create a clone of your existing virtual hard drive:
vboxmanage clonehd “PathAndName.vdi” “PathAndNameofNewDrive.vdi”
For instance, if the old drive titled Windows 7.vdi is located in S:\VirtualBox and you wish create the clone of the drive in the same location, you need to enter the following command:
vboxmanage clonehd “S:\VirtualBox\Windows 7.vdi” “S:\VirtualBox\Windows 7 Clone.vdi”
Step 5: Now that you have created a dynamically allocated virtual hard drive, enter the following command to increase its current size without any errors:
vboxmanage modifyhd –resize sizeinmbs “pathandname”
(Note that there are two hyphens before resize)
For example, if the newly created Windows 7 Clone.vdi is located in S:\VirtualBox, and you would like to expand its size to ~19 GB, then you need to enter the following command:
vboxmanage modifyhd –resize 19000 “S:\VirtualBox\Windows 7 Clone.vdi”
Once you have increased the size of virtual hard drive, you will need to remove the old drive and attach the new one by following the next two steps.
Step 6: Run VirtualBox. Select the virtual machine, click Settings, switch to the Storage tab, select Controller: SATA/IDE (see picture), click on the plus icon (Add Hard Drive option), click Choose existing disk button to browse to the new hard drive and click Open button to add the drive.
Step 7: Finally, click on the old drive, click Remove attachment to remove the virtual hard drive. Run your virtual machine before permanently deleting the old virtual hard drive just to make sure that everything is working fine. Good luck!
How to share folders between VirtualBox and Windows host machine guide might also interest you.