2014-02-13

VirtualBox: Resizing hard discs

First of all: dynamically allocated disk space does not mean that the disk will increase its size by itself beyond the maximum specified size.

I specified 20GB as max for one of my virtual boxes. This turned out to be too less for whatever reason. So I need to resize it. Here is how I did it:
Download SystemRescueCD from that link.
Create a new disk for that virtual machine with the new size. 80GB in my case (to be safe ;)). This can be done in VirtualBox by right clicking on the machine and select Settings. There you go to Storage->Sata-Controller and click on the add-disc-button.
After the disc is created add the SysteRescueCD ISO to the primary CD drive of the virtual machine.
Start the system and wait for the boot menu to appear. Select the first (default) boot option.
When it is booted type startx to get a graphical user interface. There you will presented a desktop with a terminal.
Start gparted from the terminal.
In gparted check whats the name of your old and your new hard disc. In my case the old was /dev/sda and new /dev/sdb.
Go to the terminal and execute dd if=/dev/sdOld of=/dev/sdNew. In my case dd if=/dev/sda of=/dev/sdb.
Wait till it is done (may take a while).
Exit the desktop and reboot.
Wait for the boot of SystemRescueCD and select default again.
Again: startx and then in the terminal start gparted.
Go to the new hard disc in gparted and resize it to your desired space (as it has the same size as the old disc now). After that logout and execute shutdown -h now.
In the VirtualBox main window remove the old hard disc and the SystemRescueCD. Set the new disc as primary hard disc.
Thats it.

Other Resources: http://forums.virtualbox.org/viewtopic.php?t=10348

No comments:

Post a Comment