VDI size problem

This is for discussing general topics about how to use VirtualBox.
Post Reply
DKman
Posts: 3
Joined: 8. Dec 2010, 15:13
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP SP3

VDI size problem

Post 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:
Porobu
Posts: 11
Joined: 23. May 2010, 18:39
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, 2000, 2003, Mandriva 2010 Spring

Re: VDI size problem

Post by Porobu »

use CloneVDI to compact it
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VDI size problem

Post 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.
DKman
Posts: 3
Joined: 8. Dec 2010, 15:13
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP SP3

Re: VDI size problem

Post 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
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: VDI size problem

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
DKman
Posts: 3
Joined: 8. Dec 2010, 15:13
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP SP3

Re: VDI size problem

Post by DKman »

Mmmm ... I don't know but I had some right errors doing it without being root so ...
Post Reply