After performing a quick search on how to manipulate an existing VDI file, I found a bunch of lengthy guides, all pretty much saying the exact same thing… create a new VDI, load the old and new VDI disk images into a Virtual Machine as a master and slave drive, boot with a gParted or equivalent BootCD image, and then clone the old disk to the new one… or in short: do a lot of steps that take forever, but not what I want: Resize VirtualBox Disk Image.
After flipping through the 10th or so guide, I realized that pretty much all of them were written in 2008… very unusual as bloggers usually write about the same subject on a yearly basis. That in mind, I search a bit more and… BINGO! Since VirtualBox 4 is out, there is a simple command line tool to resize VDI images. Man, those extra 5 minutes of searching just saved me from a lot of hassle and a huge waste of time.
Since I want to pass on this crucial bit of information, I hope mentioning that this article is about how to resize VirtualBox Disk Image in 1 Minute! will help to put this post up on the first page in google for people searching for this simple solution, and don't think they have to go through all those steps mentioned in other guides on how to change the size of a vdi disk image file… your help in spreading the word about this article featuring a super easy way to resize VirtualBox disk image is very much appreciated
This is for VirtualBox running on Linux, Mac, and Windows. I found the Mac solution in the comments, and there may be some more tips I may have missed to add here.
HERE WE GO:
Using Windows as a Host
Open the command prompt and enter:
# C:\Program Files\Oracle\VirtualBox\VboxManage.exe modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
Using Mac as a Host
open a Terminal session (not sure if that is what it is called in Mac, hehe) and type:
# /Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
Using Linux as a Host
open a Terminal session and type:
# VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
"C:\Virtual Boxes\Windows XP\Windows XP.vdi" OR
/Users/username/VirtualBox VMs/Litter/Litter.vdi OR
SIZE_IN_MB would be 30000 for 30GB
open a Terminal session/command prompt and type:
# VBoxManage list hdds
you will see something like this:
Parent UUID: base
Location: /VBOX/Windows XP/Windows XP.vdi
Usage: Windows XP (x86)
Using the above as an example:
# VBoxManage modifyhd 5ebf0266-4e9e-4b7e-b9f6-6d67514919c3 --resize SIZE_IN_MB
And that's already all there is to it… I just wish they would include this in the GUI.
# sudo resize2fs /dev/sda1
If you get a message along the lines of: "filesystem is already x blocks", then you need to follow my comment from August 22, 2013 08:30
Using Windows Guest System:
1. Right-click Computer and select Manage.
2. Double-click Storage.
3. Double-click Disk Management.
4. In the list, right-click the partition to expand and select Extend Volume.
5. Follow the prompts to resize the partition and click Finish. The partition item in the Disk Management pane displays its new size.
6. Close the Computer Management window
Should you be using a VirtualBox version older than VirtualBox 4 and are looking for a way to resize a VDI VirtualBox Harddisk file, here are the articles I flipped through but luckily did not have to follow:
Increase the size of a .vdi file
Resize VirtualBox Disk Image vdi files to bigger size
How to Resize a VirtualBox vdi file
Expand vdi virtualbox disk image
Grow a virtual drive, vdi Virtual box disk image
This post has been viewed 88659 times!