I've found a few guides online outlining the following process for reducing a dynamic disk image size:
- Delete anything you don't need in guest (disk cleanup, uninstall programs, etc)
- DEFRAGMENT the disk
- Use the SDELETE utility to fill up free space with zeroes
1. How does this work?
Does VirtualBox look at the actual data being written to determine if it is all zeroes and handle this case by shrinking the file? Wouldn't that make things too slow?
2. Why defragment?
Does VirtualBox only shrink the file from the end towards the beginning of the disk? Would that mean that if there was an allocated block at the very end of the disk image then no free space before it can be reclaimed (even if you run SDELETE to zero it out)?