Resizing you Virtual Disk

From Klaus' wiki
Revision as of 09:08, 9 January 2017 by Klaus (Talk | contribs)

Jump to: navigation, search

This is a short description of how you can resize your haddisk to the virtual PC.

First shut down the guest operating system - the Centos.

The free and open version of VIrtualBox does not - yet - have the capability to resize the .vmdk disk's. Therefore you have to convert the present harddisk to another format, vdi.

$ vboxmanage clonehd "d03428v1-disk1.vmdk" "clone.vdi" --format vdi

here put in your diskname, eg. "Centos.vmdk"

Now, after a while waiting time, we are ready to perform the actual resizing.

$ vboxmanage modifyhd "clone.vdi" --resize 80000

Here the disk is resized to 80 GB ~ 80000MB

Finally one could think that we now need to clone the disk back to the vmdk-format. But that is not necessary. Just delete the present disk in the VirtualBox Manager - click Settings for the particular machine and move down to Storage. Delete the attached disk, e.g. Centos.vmdk and insert the "clone.vdi" instead.

The last step is to resize the partition within the virtual machine. This can only be done, when the Linux is not running. Therefore you have to boot the virtual machine using a LiveDVD. I downloaded from a Live DVD. In the VirtualBox manager attach the Live DVD to the Optical disk controller using the CD/DVD button to the right.

Boot the system, but use the Live DVD as boot medium.

When Knoppix is up running start a console and in the console type

$ sudo gparted

and resize the main partition to the new size. Be sure to unmount the DVD after shut down to prevent booting from it once again.

Eventually take a look at this video if you need to move your swap partition.

Boot the PC and see that everything works.