You have to do the following steps:
- Run defrag in the guest (Windows only)
- Nullify free space:With a Linux Guest run this:
sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k sudo rm -rf /bigemptyfileOr:telinit 1 mount -o remount,ro /dev/sda1 zerofree -v /dev/sda1With a Windows Guest, download SDelete from Sysinternals and run this:sdelete.exe c: -z(replace C: with the drive letter of the VDI) - Shutdown the guest VM
- Now run VBoxManage's
modifyhdcommand with the--compactoption:With a Linux Host run this:vboxmanage modifyhd /path/to/thedisk.vdi --compactWith a Windows Host run this:VBoxManage.exe modifyhd c:\path\to\thedisk.vdi --compactWith a Mac Host run this:VBoxManage modifyhd /path/to/thedisk.vdi --compact
This reduces the vdi size.
EDIT:
No comments:
Post a Comment