VirtualBox : increase the size of virtual disk [Update]

virtualboxVirtualBox allows me on my MacBook, for a while, to use some applications unavailable with OSX. For example, Some applications of configuration. I produced, from my website, an video tutorial regarding the installation of a Windows system 7 on a Mac with VirtualBox.

At the first installation, the application allows to create a default dynamic virtual disk 20 GB of RAM. The term "dynamic" means that the actual size occupied by the virtual volume will be that of the files installed., and that this size will increase with new files created, up to a maximum of 20 GB of RAM. As Windows 7 system needs only 12 up to 13 GB space, that seems actually enough and one do not change this size.

But today, with more and more applications, my virtual disk is full. I cannot add more files, nor proceed the major update, as the Service Pack 1 recently available. Do not panic. Since version 4.0 VirtualBox allows you to increase the size of the virtual disk.

[SHIFT version 5.0]

For this, must proceed in two steps.

1 – Use the command-line interface VBoxManage

VirtualBox is provided, as install, with a command line interface for performing actions on the implementation progress. Detailed explanations are provided in Chapter 8 User Manual (in English). VirtualBox must be closed before using this command.

Command in Terminal :

sudo vboxmanage modifyhd "path / volume name" –resize [size]

[Update] The "sudo" command is now mandatory, your session password will be asked.

  • Volume Name : To be sure not to make mistakes in entering the absolute path of the virtual disk, must select the file .vdi in the Finder and drag it with mouse in the terminal after vboxmanage modifyhd up to between quotation marks. then type the following –resize 30720 in my example (two dashes – front resize).
  • Size : 15360 = 15 GB of RAM, 20480 = 20 GB of RAM, 30720 = 30 GB of RAM, etc,.
vboxmanage

Order entry and validation in the Terminal

Warning, in the Terminal, white spaces are replaced by the \ that you must delete and keep the spaces in the names of the folders as you read them in the Finder.

This gives the new size in the user interface of VirtualBox :

virtualbox

2 – Increase the partition in Windows

Once restarted Windows in VirtualBox, you see that the hard disk seen in the file manager is always the same size as before. That's normal, the virtual disk has been increased, but Windows only sees the partition, it, was unchanged.

You will open the utility Command Prompt in All programs > Accessories (The DOS window, equivalent of the Terminal in OSX) to launch the utility DiskPart.
Once DiskPart launched in a new window, commands to follow are :

  1. list volume (to see the number of boot volume, which displays the old size)
  2. select volume x (where x is the volume number)
  3. extend (no arguments, extend the partition to increase the size of the virtual disk)

You enter the command again :

  1. list volume (to verify that the size is identical to the one you set in VBoxManage)

You can close the window and check your hard disk is displayed with its new size :

Taille du disque

Facebooktwitterlinkedinmail

6 Replies to “VirtualBox : increase the size of virtual disk [Update]”

  1. Thank you very much for this, finally it is working!! It is working also for a .vhd. I am using a MacBook Pro OS X Yosemite, VirtualBox 5.0.0 with Windows 7 as a VM.

  2. A big thank you for this tutorial, which is still used today, I was too lazy to recreate a new disk, then, copy one over the other like it is advisable to make anywhere else, your solution is very effective, and very clean !
    Nice day
    Cordially
    Stéphane Plovier

  3. Thanks for this Guide!!! It’s very very good. used it and just took 10sec……

    Thanks again!!!!

  4. Thanks! This is a big help. Worked great with VB on MacMini OS 10.5.8 Host, Windows 7 Ultimate Guest.

  5. Hello,

    A big thank you for this tutorial.

    I'm stuck on the last command.
    Windows XP refuses to extend the partition (all the above went as expected).
    Does it could be that the disk was not created with the option Dynamics (I am not to have done) ?

    Cordially,

    Gregory DELAIRE.

    1. If the disc is displayed with its new size in VirtualBox window, that means VboxManage command worked correctly. I have not personally tested the utility Diskpart in XP. You should do a search on the forum virtualbox.org. This tutorial applies only to Vista and W7, I have no XP to run on hand.

Comments are closed.