Wednesday, March 21, 2012

Cloning and compacting VirtualBox VDI

Today I had to prepare new VirtualBox Virtual Machine by copying old one. To clone VDI file I used VBoxManage utility:

C:\Users\mariusz\VirtualBox VMs\machines>"C:\Program Files\Oracle\VirtualBox"\VBoxManage clonevdi ide.vdi orclstd11g2.vdi

After clone you can only assing new VDI file to new virtual machine.

But what to do if we need compact new machine after uninstalling few applications? We can do this in 4 simple steps:
  • uninstall / remove unneeded files
  • defragment virtual disk space
  • nullify free disk space (in Windows you can use this app: http://technet.microsoft.com/en-us/sysinternals/bb897443)
  • use VBoxManage to compact VDI file: C:\Users\mariusz\VirtualBox VMs\machines>"C:\Program Files\Oracle\VirtualBox"\VBoxManage modifyhd orclstd11g2.vdi -compact

No comments:

Post a Comment