Page 1 of 1

Shrinking VDI file with NTFS partition

Posted: 21. May 2007, 07:28
by wsun013
I have a vdi file (growing) with ntfs partition of size 4GB, used up 2GB now, but takes 3GB of spaces on my host machine.

I used

Code: Select all

vditool SHRINK ntfs.vdi
but it didn't seem shrinking at all.

I De-registed the vdi file before shrinking, but it didn't help either

any idea ?

Posted: 21. May 2007, 08:31
by achimha
You need to zero out the freespace before applying the command. This requires some 3rd party utility for Windows.

Posted: 21. May 2007, 08:34
by wsun013
By the means of "zero-out", are you saying "de-fragment" ?

Posted: 21. May 2007, 09:49
by klaus
No, zero out free space just means that the free space must be filled with zeroes. There are several tools which can do this, e.g. SDelete (http://www.microsoft.com/germany/techne ... elete.mspx), for which you need to specify the parameter -z to zero out free space.

Posted: 22. May 2007, 07:27
by wsun013
Thank you all.

I have tried SDelete from

Code: Select all

http://www.microsoft.com/technet/sysinternals/Security/SDelete.mspx
Extract it, run it within the guest OS with -c instead of -z:

Code: Select all

sdelete -c c:
and shutdown the guest OS and virtualbox
then

Code: Select all

vditool SHRINK ntfs.vdi
and it works.

Thanks again.

vditool can be downloaded from here

Posted: 18. Jun 2007, 20:36
by mustali
In case you thought vditool was installed with VirtualBox our thoughts match!

vditool is available for download here (choose Save As):
http://www.virtualbox.org/download/testcase/vditool

thanks to thedarkmaster:
http://thedarkmaster.wordpress.com/2007 ... on-how-to/