Wednesday 29 May 2013

Shrink your VirtualBox disk

After working in my VirtualBox RedHat installation my disk grew to 27Mb. I want to make is smaller so it can fit on the left over space of my 5.6Mb SSD.

Fill the disk with 0's and delete the zero file:
$ dd if=/dev/zero of=~/delete.me
$ rm ~/delete.me
 
Start the Virtial Box Manager and fix the disk:
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd --compact C:\pth-to-disk\disk.vdi