Resizing a VirtualBox .VDI virtual hard-drive file

In my last post, I created a Ubuntu VM in VirtualBox, but only used the default size of 8Gb for the size of the virtual hdd.  For some small applications, this may be ok, but it can be a large handicap when working on larger projects or with multimedia.  If I wanted to have a bigger hard-drive, I’d have two options: either create a new .VDI file, or resize the existing one.  Creating a new file would require reinstalling Ubuntu to it, along with all my programs and files, so we are going to opt for resizing our existing file instead.  In order to do this, we need access to Terminal and a Ubuntu(or other Linux distro) Live CD image.


 

The first thing we need to do is physically resize the file.  VirtualBox comes with a nifty command for doing this called “vboxmanage” that allows you to modify many aspects of your VM.  Enter the command below, substituting in the Absolute Path to your .VDI file  and the size in Mb of how large you want your .VDI to be.

vboxmanage modifyhd [AbsoluteFilePath] –resize [SizeInMb]

Once your file is modified, open up VirtualBox, and startup your VM.  Select “Devices > CD/DVD Devices > Ubuntu.iso” from your host OS’s menu bar, which will tell your VM to boot from the live CD instead of the .VDI on its next reset.  Press “R” to reset the system, and reboot the pc.


Once it boots you should again be faced with “Try Ubuntu” and “Install Ubuntu”.  This time, we are going to choose “Try Ubuntu”.  When your desktop loads, go to the Dashboard, and search for GParted.  Run it, and you should be faced with a  screen allowing you to modify your hard drive partitions.  Modify your partitions following the instructions in the video, and apply the changes.  Shutdown your VM, and on the next boot up, you should have access to all of your new space!

One thought on “Resizing a VirtualBox .VDI virtual hard-drive file”

Leave a Reply