Shrinking VDI file with NTFS partition

This is for discussing general topics about how to use VirtualBox.

Shrinking VDI file with NTFS partition

Postby wsun013 » 21. May 2007, 07:28

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   Expand viewCollapse view
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 ?
wsun013
 
Posts: 19
Joined: 21. May 2007, 07:23

Postby achimha » 21. May 2007, 08:31

You need to zero out the freespace before applying the command. This requires some 3rd party utility for Windows.
achimha
Volunteer
 
Posts: 217
Joined: 10. May 2007, 09:24

Postby wsun013 » 21. May 2007, 08:34

By the means of "zero-out", are you saying "de-fragment" ?
wsun013
 
Posts: 19
Joined: 21. May 2007, 07:23

Postby klaus » 21. May 2007, 09:49

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.
klaus
Oracle Corporation
 
Posts: 234
Joined: 10. May 2007, 14:57

Postby wsun013 » 22. May 2007, 07:27

Thank you all.

I have tried SDelete from
Code: Select all   Expand viewCollapse view
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   Expand viewCollapse view
sdelete -c c:

and shutdown the guest OS and virtualbox
then
Code: Select all   Expand viewCollapse view
vditool SHRINK ntfs.vdi

and it works.

Thanks again.
wsun013
 
Posts: 19
Joined: 21. May 2007, 07:23

vditool can be downloaded from here

Postby mustali » 18. Jun 2007, 20:36

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/
mustali
 
Posts: 1
Joined: 18. Jun 2007, 20:31


Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 14 guests