Pages

Resize the Virtual Disk Hard Drive Size | VirtualBox

Reference  http://derekmolloy.ie/resize-a-virtualbox-disk/

First shut down the instance.Then from the command prompt hit the following command

VBoxmanage modifyhd MyLinux.vdi --resize 20000

The output of this is
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

The above command changes the virtual capacity of the .vdi file to 20GB.

Now comes the real problem. Only the virtual size is changed to 20GB. The real size of the partitions inside the image is still the same. You need to extend the partition manually. The added space is there but in the state of unallocated space which could be confirmed by the command
df -hk

To extend the size of the partition (/dev/sda1), do the following steps.

  • Go to the site  http://gparted.sourceforge.net/livecd.php
  • Download the GParted Live on CD ISO file and save it in the disk.
  • In “VirtualBox” Create a new virtual machine and call it “GParted” with Type: “Linux” and Version “Linux 2.6″ or whatever version. Choose “Do not add a Hard Drive” and ignore the warning.
  • Pick the Gparted(Power Off) and click "SETTINGS".
  • Choose “Storage” and under “Controller: IDE Controller” add a new CD/DVD device. Browse to the location of your GParted ISO file and select it.
  • Then add the disk that you wish to resize under “Controller: SATA Controller”.
  • Press OK and start your GParted Virtual Machine and you should see it boot (very quickly). Choose Gparted Live (Default settings). Choose all the default settings and your language of choice. Press 0 to start X
You can see the unallocated space in the screen after the GParted has booted completely.
  • Select the swap (/dev/sda2) and delete that. Press Apply
  • Choose /dev/sda1 and click resize.
  • leave a free space of 1023 at the end. Allocate all other space for main partition. Then click apply. It might take some time.
  • Now re-add the swap space. Click the unallocated space. Right click "Add new partition" as "Extended partition" . Apply.
  • Press “+Add” and right-click the new “unallocated” to Create a new partition. Choose as “Create as: Logical Partition” and underneath “File System: linux-swap”
  • Press Apply. shutdown the Gparted and reboot the linux.

No comments:

Post a Comment

If you like to say anything (good/bad), Please do not hesitate...