[Solved] Reduce the size of the .vdi file

Discussions related to using VirtualBox on Linux hosts.
Post Reply
giannino1995
Posts: 43
Joined: 28. Nov 2014, 22:11

[Solved] Reduce the size of the .vdi file

Post by giannino1995 »

I installed Ubuntu 18.04 on VirtualBox by assigning dynamic space to the HD 2TB. Working with large files, the .vdi has grown a lot. Are there any methods to permanently remove deleted files?
Thank you
Last edited by socratis on 29. Jun 2018, 17:23, edited 1 time in total.
Reason: Marked as [Solved].
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Reduce the size of the .vdi file

Post by socratis »

User Manual, ch. 8.23 VBoxManage modifymedium, look for the "--compact" option. Also in the User Manual that gets installed with VirtualBox, in PDF format, that you can search.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
giannino1995
Posts: 43
Joined: 28. Nov 2014, 22:11

Re: Reduce the size of the .vdi file

Post by giannino1995 »

Thanks so much. I understood your intervention and documentation. But I do not understand the technical question. Where should I write the string "[--compact]"? In which file should I add the string "VBoxManage modifymedium [--compact]"?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Reduce the size of the .vdi file

Post by mpack »

I suggest that you forget VBoxManage, as that "--compact" option will do nothing by itself. Instead download CloneVDI and run it under Wine on your Linux host. Tick the "compact" option before cloning. See the release notes for details.
giannino1995
Posts: 43
Joined: 28. Nov 2014, 22:11

Re: Reduce the size of the .vdi file

Post by giannino1995 »

I solved with this code:

Code: Select all

sudo apt install zerofree
df
zerofree -v /dev/sda1
halt
cd "C:\Program Files\Oracle\VirtualBox"
VBoxManage.exe modifymedium "F:\...\UBUNTU 18.04 LTS.vdi" --compact
With the second system you write I would have spent less time?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Reduce the size of the .vdi file

Post by mpack »

Much less time, yes. Like, you would have been finished in a few minutes instead of however long it took you to run zerofree.
giannino1995
Posts: 43
Joined: 28. Nov 2014, 22:11

Re: [Solved] Reduce the size of the .vdi file

Post by giannino1995 »

Where can I find the software for Ubuntu 18.04?
Thank you
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

Re: [Solved] Reduce the size of the .vdi file

Post by ChipMcK »

mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solved] Reduce the size of the .vdi file

Post by mpack »

giannino1995 wrote:Where can I find the software for Ubuntu 18.04?
I assume you mean CloneVDI. CloneVDI is a Windows (Win32) app, it is not available as a native Linux app. However you can run it on Linux under Wine, and I'm told it runs well that way.

I deleted your crosspost of this question.
giannino1995
Posts: 43
Joined: 28. Nov 2014, 22:11

Re: [Solved] Reduce the size of the .vdi file

Post by giannino1995 »

I'm exhausted. I'm happy with ZeroFree.
thank you
Post Reply