Difference between revisions of "Resizing you Virtual Disk"

From Klaus' wiki
Jump to: navigation, search
Line 1: Line 1:
This is a short description of how you can resize your haddisk to the virtual PC.
+
This is a short description of how you can resize your harddisk to the virtual PC.
  
 +
===Preparation===
 
First shut down the guest operating system - the Centos.
 
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.
+
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.
  
 
<source lang=bash>
 
<source lang=bash>
Line 11: Line 12:
 
here put in your diskname, eg. "Centos.vmdk"
 
here put in your diskname, eg. "Centos.vmdk"
  
Now, after a while waiting time, we are ready to perform the actual resizing.
+
===Resizing===
 +
Now, after a short waiting time, we are ready to perform the actual resizing.
  
 
<source lang=bash>
 
<source lang=bash>
Line 19: Line 21:
 
Here the disk is resized to 80 GB ~ 80000MB
 
Here the disk is resized to 80 GB ~ 80000MB
  
 +
===Finalising===
 
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.
 
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.
  
Line 25: Line 28:
 
In the VirtualBox manager attach the Live DVD to the Optical disk controller using the CD/DVD button to the right of the '''Storage''' settings.  
 
In the VirtualBox manager attach the Live DVD to the Optical disk controller using the CD/DVD button to the right of the '''Storage''' settings.  
  
[[File:VirtualBox2.png|800px]]
+
[[File:VirtualBox3.png|800px]]
  
 
Boot the system, but use the Live DVD as boot medium.  
 
Boot the system, but use the Live DVD as boot medium.  
Line 38: Line 41:
  
 
Boot the PC and see that everything works.
 
Boot the PC and see that everything works.
 +
 +
===Clean up===
 +
The very last thing to do is to delete the original vmdk file, that housed the original disk for the virtual machine and of course if you don't need the Swiss knife any more delte the Knoppix iso.

Revision as of 09:23, 9 January 2017

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

Preparation

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"

Resizing

Now, after a short 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

Finalising

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 - pick one of the newest down the page.

In the VirtualBox manager attach the Live DVD to the Optical disk controller using the CD/DVD button to the right of the Storage settings.

VirtualBox3.png

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.

Clean up

The very last thing to do is to delete the original vmdk file, that housed the original disk for the virtual machine and of course if you don't need the Swiss knife any more delte the Knoppix iso.