Hi Folks: I had a very hard time trying to compact my drive image. It seemed like a good idea to relay the problems and resolution here so others can learn from it and perhaps get the manual[1] updated.
I'm running an Ubuntu 10.4 host and a Windows 7 guest. The virtual drive was set up to be variably sized, maxing out at 50GB. The drive in the guest was formatted to be 50GB, of which 24GB was used. Attempt 1: VBoxManage modifyhd Windows7Ultimate64.vdi --compact It just reduced the size a little. That's to be expected. Attempts 2, 3, 4, 5: * Loaded the guest. * In each of the attempts used one of the following: Windows' defragger, Sysinternal's contig, PerfectDisk's prepare for shrink mode. * Downloaded Sysinternals sdelete from MS and ran "sdelete -c c" which ran fine. * Shut down the guest. * Run the compact command. That didn't make any headway. As the ordeal went along, the drive image file was as big as 36GB. Perhaps that happened here. Attempt 6: * Load guest. * Open the C shell that MS distributes in its UNIX SDK/subsystem. * Use dd to write /dev/zero to a file, then delete the file. * Shut down the guest. * Run compact. No love. Attempt 7: * Load the guest. * Use Computer Management | Drive Management (or whatever it was) to shrink the drive. * Exit the guest. * Run compact. Nope. Attempt 8: * Attach an Ubuntu live distro ISO to the VM. * Boot the VM, hit F12, pick boot from CD and then "try Ubuntu." * Use gparted to resize the partition down to 26GB. * Use "parted /dev/sda unit s print" to determine geometry. * Use dd to write /dev/zero to the unpartitioned space. * Shut down the VM. * Run compact. Halelujah! At that point I did the following to keep the file size down in the long run, I think in this order: * rebooted to the live distro * used gparted to increase the partition to 28GB. * created a new virtual 28GB drive. * Ran clonehd --existing of the old file to the new file. Thanks, --Dan [1] http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ VBox-users-community mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/vbox-users-community
