Page 1 of 1

VDI size problem

Posted: 8. Dec 2010, 15:29
by DKman
Hello everyone,

I am trying to cut space on my VDI file to be able to save it on a DVD (4,7Gb) but i have a problem ...

Image

Guest : Windows XP SP3 / NTFS partition

1) I've defragmented the partition, the VDI file went from 5Gb to 6Gb ... :( :(

2) I've used SDelete to "zero" out the free space on my drive has explained here :
http://forums.virtualbox.org/viewtopic. ... ht=vditool

Code: Select all

sdelete -c c:
The VDI file went from 6Gb to 7,8Gb .... :( :( :( :(

So now my question is simple : how to get my VDI file back to around 3,2Gb :?: (the actual size used on this partition)

Do i have to defrag the partition under Windows and copy the whole partition to a new VDI file with gParted :?:


Thx for any help :mrgreen:

Re: VDI size problem

Posted: 8. Dec 2010, 17:25
by Porobu
use CloneVDI to compact it

Re: VDI size problem

Posted: 8. Dec 2010, 17:36
by mpack
Defragmenting makes a filesystem more efficient (speed wise), not more compact - so your first observation is no surprise. Sdelete is a preprocessing step which you use prior to using VBoxManage to compact the VDI... and again the fact that no compaction is observed until you run the actual compaction step, is also not a surprise.

Also, getting your advice from an ancient thread assumes that things have not moved on since then, when in fact they have. These days, the simplest and fastest way to compact a VDI is to use CloneVDI (see sticky in Windows Hosts forum), in which case the sdelete step is not necessary. Defragging prior to using CloneVDI is not necessary either, although it may sometimes gain you a few percent.

Don't expect miracles. However you do it, compaction is not compression. The drive can't easily become smaller than the data it contains, so to get the VDI file much smaller you usually have to identify the biggest space hogging files that you don't absolutely need - and delete them. Then compact. Of course to do this you need to know what files you need and what you can delete. You can google for that across the web.

Re: VDI size problem

Posted: 9. Dec 2010, 11:42
by DKman
Thanks for the advice. I used VBoxManager to clone the vdi file, it went back to 3,4Gb ! :D :D :D

The vmdk file after export is even smaller : 1,8Go :mrgreen:

Under Linux as root :

Code: Select all

sudo su -
chmod 777 <sourceVDI>
VBoxManage clonehd <sourceVDI> <targetVDI> --format VDI

Re: VDI size problem

Posted: 11. Dec 2010, 20:49
by Sasquatch
And why go to root? The action is done on your own files, so you don't need root privileges. Run VBoxManage as your normal user.

Re: VDI size problem

Posted: 16. Dec 2010, 15:01
by DKman
Mmmm ... I don't know but I had some right errors doing it without being root so ...