Tuesday, December 14, 2010

Shrinking Virtualbox VDI files to save disk space

Virtual Box VDI format files grows quite heavy over the time.
These following methods can be used to shrink the virtualbox VDI virtual hard drive files in various environments.

To compact the Windows Virtual Machine on Windows Host OS

1)Defragment the drive
2)use nullfile.exe tool to write 0 byte to the file
3)run command as in case of windows platform
// VBoxManage modifyvdi " vdi path " compact // <---- COMMAND

To compact Windows Virtual Machine on Linux host OS
Defragment it.
nullfile it.
VBoxManage modifyhd NAME-OF-YOUR-VIRTUAL-HARD-DRIVE --compact

To compress Linux Virtual Machine on Linux Host os
sudo dd if=/dev/zero of=/zerofile
sudo rm /zerofile
VBoxManage modifyhd NAME-OF-YOUR-VIRTUAL-HARD-DRIVE --compact

To compress Linux Virtual Machine on Windows Host OS
sudo dd if=/dev/zero of=/zerofile;
sudo rm /zerofile
// VBoxManage modifyvdi " vdi path " compact // <---- COMMAND

No comments:

Post a Comment