Tuesday, September 20, 2016

Resize virtual box parition without loosing the data


1) Execute below commands to get the resized SDK.

VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 20480
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk

In above :20480  is  20Gb =(20* 1024 Mb)

2) Still it will show the same size .Need to partition the newly
   extended space .
  Use Gparted tool to parition it.
 
3) Download gparted ISO file. from : http://gparted.org/download.php

4)  Change boot order in Virtual Box  to use CD first .

5)  Add downlaoded gpartede iso image in virtual box storage section.

6) From gparted tool :
   Now you can see the unallocated space at the end.
    like  |main |swap |unallocated| .
            a) delete swap (remember size of SWAP)
            b) extend/resize the main till end of unallocated.keep                  in mind leave space for swap at the end.
            c) create swap parition at the end for the same size.
    Press appy button & once processing finished .Exit & Shutdown.

7) Change the bootorder to harddisk first & restart the virtual machine again.
     
8) Now you can see the parition resized ($ df -h)


No comments:

Post a Comment