How to Expand the Hard Drive Size of a VM

From DISI
Jump to: navigation, search

First, make sure the machine is powered off.

Next, change directories to where the image is located. To determine this, right click on the machine and in the dropdown menu, select Settings. Then select Storage. Then click on whatever is under "Controller:SATA" line and on the right you will see "Location:/home/blah/blah.vdi". This is where the image is.

Copy the image, in case something goes wrong (ie, cp LabWindows.vdi LabWindows_back.vdi). This step should take a bit to complete.

Then type on the command line:

VBoxManage modifyhd LabWindows.vdi --resize 81920 (this will change it to 80GB)

You should see something like this:

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Then download gparted and save it. Download it here: http://downloads.sourceforge.net/gparted/gparted-live-0.18.0-2-i486.iso Then, in virtualbox, right click on the virtual machine and click on Settings. Then click on Storage. Then right click on the Controller:IDE to add a CD/DVD. Then load it with the gparted iso in your Downloads folder. Then start the virtual machine. You will go through a series of prompts. I just hit enter through all of them for the default.

Once you are in gparted, right click on the partition and select resize/move. Then drag the right side of the current partition all the way to the end of the right side. Then click Apply up at the top. Once that's done exit and shutdown. Then make sure the gparted CD is now not there anymore in Storage. If it's not, start your vm up again and it will say that it's validating and then it should be repartitioned.