2008年5月20日 星期二

Shrink a VirtualBox 1.5.0 Windows Guest Virtual Disk

VirtualBox - Shrink your VDI images. Image size = Space used up inside VM.
http://kakku.wordpress.com/2008/06/23/virtualbox-shrink-your-vdi-images-space-occupied-disk-size/


from http://murga-linux.com/puppy/viewtopic.php?t=21797
Problem: Your XP virtual disk file in VirtualBox 1.5.0 has grown too large due to fragmentation. Even though you only have 4 gigs of stuff on the disk, the file is 12GB large!

Here's what you need to do:
1. Defragment the disk, moving files to the beginning of the disk.
2. Overwrite all empty space in the disk file with zeros.
3. Close the windows VM and compact the disk file

You need these free tools:
http://www.dirms.com/
http://www.microsoft.com/technet/sysinternals/Security/SDelete.mspx

First, boot up your Windows VM under VirtualBox.

DirMS will defragment the disk and move all files to the beginning (leaving all the free space at the end of the disk.) Run the command:

dirms c -q
or
dirms c

You may need to run this several times. Run the built-in XP defrag utility to get a visual map after running dirms. You'll see the improvements.

Now wipe the free space with zeros:

sdelete -c c:

Now, exit your Windows VM and go back to a Puppy prompt:

VBoxManage modifyvdi compact

That should compact your disk file!

沒有留言: