Buscar este blog

domingo, 18 de octubre de 2015

Virtual Box - CentOS - Shrink VMDK disk

We start with a bunch of VMDK files and we want to shrink their size. The steps are as follow:
1) Unlink el VMDK of the virtual machine from VirtualBox

2) Convert the VMDK to VDI
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd --format VDI CentOS6.6-base.vmdk Integracion.vdi

3) Link the VDI again to the virtual machine

4) Nullify the empty space (this example is for CentOS)
dd if=/dev/zero of=/bigemptyfile bs=4096k
rm -rf /bigemptyfile

5) Compact the VDI
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd Integracion.vdi --compact

6) Convert the VDI to VMDK, and specify the split option
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd --format VMDK Integracion.vdi Centos-Integracion.vmdk --variant Split2G

7) Link de VMDK to the virtual machie


Note: VBoxManage is one of the command-line tools which are installed with Virtual Box.

No hay comentarios:

Publicar un comentario