So you created a disk for your Windows or Linux VirtualBox VM and you made the mistake of not creating the drive as a dynamically expanding storage drive, you chose fixed size.
Now you’re running out of space and all your Google searches point you to stupid posts on the virtualbox.org forums that lead to nowhere, specially if you are a MacOSX user, look no further, you’ve found the solution to your problem on this post.
VirtualBox for Mac comes with a tool called VBoxManage, this tool is all you need to resize your virtual disk.
When you’re using the VBoxManage tool make sure your VM is not running, stop it completely to be safe.
Step 0. Backup your current drive (optional)
I recommend that before you do anything you clone your existing drive, just in case…
You can clone your drive using guess what? yes, the VBoxManage tool. No need to download any external tools.
[bash]$ VboxManage clonehd <path to your original drive> <path of the copy>[/bash]
in my computer it looked exactly like this:
[bash]$ VBoxManage clonehd /Users/gubatron/VirtualBox VMs/windows7-64bit/windows7-64bit.vdi /Users/gubatron/windows7-64bit.cloned.vdi
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%[/bash]
If you don’t know where your .vdi file is, it’s very simple, right Click your VM > Settings > Storage, and mouse over the .vdi to see it’s physical location on your Mac hardrive.
Step 1. Resize!
The command to resize is:
[bash]$ VBoxManage modifyhd <path to your vdi> –resize <new size in megabytes>[/bash]
In my case I had a 20GB drive that I wanted to double in size (40GB), a quick Google search for “40GB to megabytes” yields the number 40960, so that’s what I put on my –resize parameter.
This is how it looked for me:
[bash]$ VBoxManage modifyhd /Users/gubatron/VirtualBox VMs/windows7-64bit/windows7-64bit.vdi –resize 40960
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%[/bash]
The ‘resizing’ is almost immediate.
Step 2. (Re)Start VirtualBox
After you’ve physically resized your drive, both VirtualBox and your OS should know about the changes.
At this point, clicking on your VM in the VirtualBox window will show that it still has the old size:
Before: (Note the size of the drive at the bottom of the image)
After doing the resize, shutdown completely your VirtualBox, and launch it again. When you see the information about the storage drives attached to your VM you should see the new disk size.
After: (Note the size of the drive at the bottom of the image)
Step 3. Let your OS know the new logical size of the drive
When you start your VM, it won’t know right away what the new size of the disk is, you’ll have let the operating system know that there is additional space it can use.
If your VM is running Windows 7, the way to let the operating system know that it can use the additional space on your drive is very straight forward.
Click on the Windows (Start) Icon on the Bar > Right Click on “Computer” > Manage (You’ll need to be an Administrator)
The “Computer Management” window will open, in it go to:
Storage > Disk Management > Right Click on the partition you want to extend.
Select the option that says “Extend”, a Wizard will open, just hit Next until it ends if you want to use the whole space.
After you’re done, if you refresh your “Computer” on the File explorer the resized drive should show right away
That’s it, enjoy and let me know how it went.
Nice, except for one small detail. The screenshot you show is for a dynamically allocated disk. You can tell because the actual and virtual size is not the same as t would be on a fixed size drive. Secondly the text obscured by the tooltip is not “Fixed size storage” but rather something with ellipses at the end which does not fit in the space allocated.
Trying this process with VirtualBox 4.1.4 results in the message:
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
AH but now the solution is made obvious once I noticed something When you clone the original drive to make a backup, the tool creates a dynamically allocated disk, even if the original was fixed size. So at that point you can treat your ‘original’ disk as the backup, and expand the newly created clone.
I dont have .vdi but i’ve .vhd (VirtualBox 4.1.4) My problem is that I don’t know where do i have to write the command – in the terminal or somewhere else outside the Virtualbox program? ‘Coz when I wrote the command into the terminal, it said: “command not found”. What could I do? (I’m new to mac, sorry)
Using Virtual Media Manager copy your VHD file to a new VDI one. Then type the command from the Virtualbox installation folder.
Hi
I am the same problem.
I need to resize a vdi (4.1.6) installed on Mac OSX.
Executing
VBoxManage modifyhd mystorage.vdi –resize 9000
returns :
VBOX_E_NOT_SUPPORTED
What’s wrong ?
Regards
Marcus
hopefully that vdi is not too old… did you google that VBOX_E_NOT_SUPPORTED error?
Hey – the guide is really nice. I’m only having trouble with the disk management part at the end. I upgraded my 20 GB to a 100GB using methods 1-2 above, however, when I got to part 3, the 20 GB “Disk 0” was still there even when under my SATA port 0, it says ((italicized) Normal, 100.00GB)… Any idea how I can get it to say 80 GB unallocated in my Windows 7 Disk Management Part?
Thanks for the tip! It helped!
How do I merge the disk on Windows XP guest?
worked like a charm…thanks!
Thanks a lot for the tip! Worked fine for me! 🙂
Worked great! Thank you for this post.
This is the best guide for expanding fixed virtual hd on the internet. Thanks a lot.
I’ve followed the instructions and the VirtualBox shows the HDD’s new size, but from Disk Management of the guest OS (Windows 7 x64) the disk stills shows the old size (it doesn’t show the unllocated piece).
Any ideas?
Hello, please help ! I tried this but it seems it has some syntax error, (I m not used to mac terminal) so I wrote this
VBoxManage modifyhd /Users/Me/VirtualBox VMs/windows xp/windows xp.vdi –resize 40960
but it shows Syntax error: Invalid parameter ‘VMs/windows’
Also I should note that although it finds VirtualBox VMs with ls at Me directory, I cant find it with cd. How can that be? I am so confused.
And last but not least, I use a vhd instead of vdi, but I can locate both of them in the folder. Which should I choose? please help !!
Thank you !
Hey Luna, try this
VBoxManage modifyhd “/Users/Me/VirtualBox VMs/windows xp/windows xp.vdi” -–resize 40960
To Jake and Luna (and anyone else having the same problem): If you try to do this and run into the problem that the unallocated space is not appearing, it is probably because you are using the “snapshots” feature of VirtualBox. You have probably only changed the “base image” of the virtual machine. I just did this, and I hope that I haven’t messed up my snapshots. Probably the best thing to do is to get rid of all your snapshots before trying to do this.
For some more info, see https://www.virtualbox.org/ticket/9103
Oops, sorry, I meant Jake and Francesc, not Luna (hers is a different error I’m afraid).
I have since tried to delete my snapshots so I could just repeat the disk resize on the current state, but VirtualBox balks when I try to delete the last snapshot (presumably because the disk sizes don’t match between the states it is trying to merge). I am now attempting to clone the disk; hopefully I’ll end up with one “current state” that can then have the disk resized. I’m worried, though, that I’ve done some irreversible changes to the VM.
They really should include a warning about resizing virtual machine disks when using snapshots, if it is possible to irreversibly damage them. I guess I should have done my own backup before attempting this.
Just an update: I was able to get this working by making a clone of the original VM. Just make sure to choose “Full clone” (not “Linked clone”), and “Current machine state” (not “All states”). This gave me a VM with just one “Current state”, which I was then able to resize the disk for in the manner described in the article.
Luna,
You should put path in double quotes, stupid moron.
VBoxManage modifyhd “/Users/Me/VirtualBox VMs/windows xp/windows xp.vdi” –resize 40960
Great! Thank you!
Thanks for the information this has helped save my a lot of time!
It worked beautifully. Thank you!!
Great! Thank you!
Hi, Thanks man! It work great!!
And Thanks to Chuckvdl that pin pointing the problem with fixed size disk!
i also need help!! 🙁
i get syntax error: invalid parameter: ‘50000’
it complains about the size i ask, why is that? i googled it and everything and i can’t find the answer!
Saved my life!
i got Syntax error: Mandatory output file parameter missing when i try to clone it and another Syntax error when try to resize it, please help
Thanks Gubatron, this worked like a dream (the tip about putting the filename in inverted commas was also invaluable, wojtas) and it’s really saved my bacon.
This totally worked!!!! Thank you so much!!! going to Palaver’s site helped too!!! 🙂
Great. That works. BTW, the images in the post are not showing up
thanks for the reminder, gotta see what’s up with the image folder.
images fixed!
Thank you very much. It was a very helpful tip.
This solved a big headache of mine! Thank you
I’ve gotten to the part where I’m supposed to use the extend feature. Mine is greyed out. I think it’s because I had set the Disk to Dynamically allocate the space. How can I still extend this drive?
Thanks!
Thanks This really did help but unfortunately I learned the long way. This has everything what you need to do extent a win 7 virtual drive on mac. Thanks
“if you are a MacOSX user, look no further, you’ve found the solution to your problem on this post.” — Yes indeed! Thanks!
glad to be of help.
Many thanks for this! Exactly what I was looking for!
It worked but with slight modifications. Had to resize the filename.cloned.vdi file in step 0 NOT the original hard disk vdi file.
When I used this directly i got errors:
VBoxManage modifyhd “/Users/tamika370/VirtualBox VMs/win7/win7.vdi” –resize 40960
0%…
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
So I USED THIS INSTEAD (keep in mind i saved the cloned vdi file in my user directory):
VBoxManage modifyhd win7.cloned.vdi –resize 40960
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
Then followed steps 2 onwards which worked PERFECTLY! Thank you so much
Hi all, played around a bit and tried to increase my hd size in vbox….now I am getting this message and can’t restart my VM anymore….help….what went wrong??
Für die virtuelle Maschine Windows 7 konnte keine neue Sitzung eröffnet werden.
pci#0: Device in slot 0x58 has been removed! vendor=0x8086 device=0x265c [ver=3 pass=final] (VERR_SSM_LOAD_CONFIG_MISMATCH).
Fehlercode:NS_ERROR_FAILURE (0x80004005)
Komponente:Console
Interface:IConsole {8ab7c520-2442-4b66-8d74-4ff1e195d2b6}
Worked PERFECTLY! Thank you so much.
Your a man among boys. Thanks boss!
Thanks, still very useful three years on!
Hi all.
I am running VBox (4.2.18) on Mac iOS (10.9.5).
I had a problem with the path to vdi file.
My command on terminal (Mac OS) is:
VboxManage modifyhd /Usuários/Ruas/VirtualBox/Windows XP.vdi –resize 20000
The error message is: Syntax error: Invalid Parameter ´XP.vdi`
I had run Sdelete on guest machine before these steps.
I am sure the path is correct. I tried to rename vdi file, I tried to underline, quotes, etc, and it didnt work. I also tried Users instead Usuários on path to vdi file.
Somebody help me, please!!!
Tks
worked like a charm…thank you! You should also take note of these corrections……
VBoxManage modifyhd “ .vdi location” –resize 40960
Thank you
Well dude, after seeking for VBoxManage on MAC (I’m not Mac user), finally I can resize my VDI.
You must point out how does it start the famous command: start a terminal sesion on your Mac and type the command,
Thanks from Colombia
Hagen
I wasn’t able to resize the drive as it was a boot drive. I added my Windows7 ISO and rebooted, booted form the ISO, went into the Windows7 installer and choose custom install, and then advanced drive options, and there you could extend the drive since you were no longer booting from it.
Thanks!
Thanks.
Worked perfectly:
VBoxManage modifyhd “/Users/Quim/VirtualBox VMs/W7/W7.vdi” –resize 50000
OSX 10,9,5
VirtualBox 4,3,20
Virtualized to W7 x64
Tips still work. All I had to do was drag the .vdi file to Terminal window to get the correct file address. Thanks!