Ye blog of Adam Wright
DIY, tutorials, stuff for geeks, all updated when I have the time to spare.
How to increase the size of a VirtualBox hard drive
04/03/2012
Posted by on These are the steps to increase the virtual hard drive size of a VirtualBox machine. These worked for me in Ubuntu linux, but the command should work for Windows as well I believe.
EDIT: Reader recuperar arquivos confirms that this also works in Windows.
Snapshots aren’t supported so first you’ll need to clone the current snapshot into a new machine. Once that’s done, open up a terminal window and type this:
vboxmanage modifyhd “/file/location/of/virtual/harddrive.vdi” –resize 40960
(that “resize” flag needs a double-hyphen in front of it, not just one)
40960 MB = 40 GB
If you want to resize to say, 100GB, you’d use 102400 at the end.
Any questions feel free to leave a comment!
Thanks! Good tip. I’ve always wondered about this since I sometimes get close to the limit that I initially set….
Happens to all of us. Glad I could help!
I just did this on my drive, and now in VirtualBox it says 40GB (instead of the 20 I originally set my drive to), but in my Windows 7 virtual machine the Windows file explorer still shows 20GB. Will it dynamically increase up to 40GB as I need it, or did I do something wrong?
You’re correct, it will dynamically increase up to 40GB as needed.
My experience was that it didn’t dynamically expand (Ubuntu 12.04 host, Windows 7 guest). But, I found the following post that resolves this by using the partitioning tool in Windows 7: http://tinyurl.com/ac34myf
Thanks!
Having a larger size virtual hard drive has been extremely helpful in my business. Definitely something to consider if you’re always seeking out more space. Worked with Windows for me with no issues.
Great to hear! I assumed the same method should work in Windows, but I hadn’t tested it.
Excellent. Very useful.
In Ubuntu 12.04 however the resize needs a double hyphen (–resize)
But not difficult to work out.
I see that the system here has removed the double hyphens I had put in the bracket example. It probably did the same to your own original.
Yes that is correct, I honestly didn’t even notice that the WordPress post took the double hyphen out haha!
I went back to edit the post to [try to] fix it, and the original has two hyphens, but the published post only shows one. Weird.
Anyway, thanks for noticing it!
Many word processing programs automatically convert double hyphens into a long dash.
I am having trouble getting this to work on my system. (Mac OSX Lion, host; Windows XP, guest). I believe it may be a simple syntax error, since I have folders and files with spaces in their names, and I’m not sure how to type them so that it recognizes a single file name (I hope that makes sense!).
I’m not a savvy Terminal or VirtualBox user, and not a programmer, either. I AM a long-time Mac user and have a decent grasp of technical things because I used to do a lot of my own troubleshooting, etc. Can you please show me EXACTLY what I need to type when Terminal opens? I see the cursor there after my name with a dollar sign after it. The path I follow to get to the .vdi file is: juliatavis >> VirtualBox VMs >> Windows XP >> Windows XP.vdi
I just had a 512GB SSD installed and would like to expand my VirtualBox drive to 120GB. I am using a graphics program where I use LOTS of high-res photos, so I need substantial space, and don’t need more than 300GB on the Mac side. I would SURE appreciate your input and help. Thanks so much…
Just figured this out after several hours of research and trying! If you are on a Mac host, using Terminal, here’s how you need to type it. Since I am not a Terminal user, I was struggling. You need to type it like this (after the $ that is after your name in the window that appears in Terminal):
VBoxManage modifyhd “VirtualBox VMs/Windows XP/Windows XP.vdi” –resize #####
The number should be displayed in megabytes. I was expanding to 80GB, so I typed 81920 (80 x 1024). Make sure you type the path in quotation marks and begin with whatever location comes after your username. My actual path was: Macintosh HD/Users/juliatavis/VirtualBox VMs/Windows XP/Windows XP.vdi
Hope this saves someone the hours of searching and trying that it took me to find success!
HI am parameshwar, I am not able to get the expected in windows output when i used the command it says
VBoxManage.exe: error: The medium ‘W:\pinstall\Win2k3 Hard Disk’ can’t be used a
s the requested device type
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component Medium, inte
rface IMedium, callee IUnknown
Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadW
rite, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 210 of file VBoxManage
Disk.cpp
This looks out of my realm of VirtualBox knowledge, but at first glance it looks like there may be a problem with the filename or syntax you’re using?
It could easily be something else as well, maybe others here can help…
Hi, I’m running Ubuntu 64 bit server in the VirtualBox, I modified my hd from 4096 MB to 5096 MB. But still the ext4 partition is 2.8 GB only. How to increase the size of this ext4 partition
Sounds like you might need to modify the partition, see my reply to tom.
This didn’t work. It did change the virtual box setting from 40gb to 100gb. However, when I boot up th ethe guest OS, red hat linux 5.7, it doesn’t see the extra space. The guest still thinks it has only 40gb.
I’m not 100% sure, but it sounds like you might need to extend the partition to use the extra [unallocated] partition space. I’m probably wrong though, in which case I’m probably no help to you, sorry friend.
I spent an hour looking into gparted and gave up. I’m just going to create a new virtualbox. repartitioning is friggin hard
It can be, yeah. I’ve had a couple times in the past when I needed to repartition in both linux and Windows, I managed to get it done, but it took some in-depth research and testing.
I know how to avoid the problem below:
“VBoxManage.exe: error: The medium ‘W:\pinstall\Win2k3 Hard Disk’ can’t be used a
s the requested device type
VBoxManage.exe: error: Details: code E_FAIL (0×80004005), component Medium, inte
rface IMedium, callee IUnknown
Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadW
rite, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 210 of file VBoxManage
Disk.cpp”
The problem is the “” in the command line code:
vboxmanage modifyhd “/file/location/of/virtual/harddrive.vdi” –resize 40960
Try this instead, cd to the location of vdi, for example /home/raphael/VirtualBox\ VMs/Windows/ and do this:
vboxmanage modifyhd harddrive.vdi –resize 40960
It will work!
You can easily resize the partition to make use of the larger VM size. To resize partition size or change the size of partitions in Windows Vista or 7:
1. Click on the Start button, and then right click on Computer and select Manage.
2. In the Computer Management console, click and expand Storage branch, and click on Disk Management to open and access Disk Management Console.
3. Disk Management Console display the details of all available volumes and disk drives in the computer configuration in the right pane.
4. Right click on any volume or partition that needs to resize or change the size, and select either 5. Expand (to increase the size) or Shrink (to reduce the size) to change the size of the partition.
6. Enter amount of space to expand or shrink in MB (cannot exceed the size of available expand or shrink space in MB).
7. Click on Expand or Shrink button when done.
8. Windows Vista/7 will reduce or extend the size of the partition online immediately, without the risk of data loss.
I was getting the following error: Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!
I started down other paths since I received the error. I then caught the fact that you said you have to clone the snapshot. I cloned the snapshot, reran the command and it worked!
Thank you!
Glad to hear!
So great you’ve written it, saved me an hour pain. Thanks!
Glad to help!
I cloned my vm with snapshots to a vm without snapshots.
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd G:\VMWares\OVM\suse_db1_Clone\suse_db1_Clone.vhd –resize 102400
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
I can see the increased size in the vm details.
Butm when I start the VM, I see the error:
“FATAL: Could not read from the boot medium! System halted.”
Any ideas?
With gparted iso, I see 100GB as unallocated. Something went wrong.
Not sure, haven’t dealt with cloning vms with snapshots to ones without snapshots. Maybe try to clone it first and then try to increase the size? (Dunno if that’s what you’re already trying)
That is what I’ve done, as you mentioned in ur blog –
“Snapshots aren’t supported so first you’ll need to clone the current snapshot into a new machine.”
Sorry I can’t be more help.
Hello,
for this to work the hard drive needs to be dynamic and not fixed. So if you have a fixed drive you will get the error:
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard drive operation for this format is not implemented yet!
You then need to do this:
VBoxManage clonehd [old-VDI] [new-VDI] –variant Standard
VBoxManage modifyhd [VDI] –resize [megabytes][\code]
from url=https://brainwreckedtech.wordpress.com/2012/01/08/howto-convert-vdis-between-fixed-sized-and-dynamic-in-virtualbox/]here[\url]
Then I created a new virtual machine from the new hard drive I created (selecting from an exisitng virtual hard drive)
Then I did what @codeark said above.
This sorted it for me!
Thanks