[Solved] Virtualbox 6.0: vdi file size is huge

Discussions related to using VirtualBox on Windows hosts.

[Solved] Virtualbox 6.0: vdi file size is huge

Postby Ahmed Haroon » 30. Oct 2019, 13:28

the problem:

we had a VBox of Windows XP which .ova file size is 26.5 DB,
has storage (Dynamically allocate) type IDE which virtual size is 100 GB, Actual size 73.5 GB (in settings)
when run this VM, check properties of volume C: ( this is only partition ), it is showing
Used Space 11.7 GB and Free Space 88.2
after import appliance file size of its .vdi is 73.2 GB
my question is why its file size of .vdi is 73.2 GB, this is huge.

for comparison only with above mentioned:

another Windows 7 machine has .vdi file size = 21.3 GB
storage type SATA, Dynamically allocated
Virtual Size = 60 GB
Actual Size = 21.40 GB
when run and check through properties, Used Space = 27.1 BG and Free Space 32.7 GB

question for help:
is it my some kind of understanding problem, or i can reduce the .vdi file size? if yes, how it can be done?

regards
Last edited by socratis on 31. Oct 2019, 13:25, edited 1 time in total.
Reason: Marked as [Solved].
Ahmed Haroon
 
Posts: 12
Joined: 29. Mar 2019, 15:28

Re: Virtualbox 6.0: vdi file size is huge

Postby mpack » 30. Oct 2019, 13:34

The VDI can occupy any amount of host space up to the designated capacity, i.e. 100GB. The exact amount depends on which sectors have been written to.

Perhaps you should give the reasons why you expect otherwise. E.g. explain why a hardware simulation of a disk would care about what a guest OS says is mapped to files (a software concept).
mpack
Site Moderator
 
Posts: 31397
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 6.0: vdi file size is huge

Postby socratis » 30. Oct 2019, 13:36

Ahmed Haroon wrote:i can reduce the .vdi file size? if yes, how it can be done?

User Manual, 8.24 VBoxManage modifymedium, focus on the "--compact" option.
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.
socratis
Site Moderator
 
Posts: 27690
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Virtualbox 6.0: vdi file size is huge

Postby Ahmed Haroon » 30. Oct 2019, 13:41

mpack wrote:The VDI can occupy any amount of host space up to the designated capacity, i.e. 100GB. The exact amount depends on which sectors have been written to.

Perhaps you should give the reasons why you expect otherwise.

thanks a lot for a very quick response :)
i have posted my VM for windows 7 for comparison which shows the .vdi size is near to the size of Used Space showing in properties
.vdi = 21.3 GB
used space = 27.1 GB

it is very confusing and disturbing at least for me.

regards
Ahmed Haroon
 
Posts: 12
Joined: 29. Mar 2019, 15:28

Re: Virtualbox 6.0: vdi file size is huge

Postby Ahmed Haroon » 30. Oct 2019, 13:42

socratis wrote:
Ahmed Haroon wrote:i can reduce the .vdi file size? if yes, how it can be done?

User Manual, 8.24 VBoxManage modifymedium, focus on the "--compact" option.

thanks a bunch, i will check and give feedback :)
regards
Ahmed Haroon
 
Posts: 12
Joined: 29. Mar 2019, 15:28

Re: Virtualbox 6.0: vdi file size is huge

Postby mpack » 30. Oct 2019, 13:42

socratis wrote:]8.24 VBoxManage modifymedium - focus on the "--compact" option.

Or, non-masochists can try the compact feature in CloneVDI. :)
mpack
Site Moderator
 
Posts: 31397
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 6.0: vdi file size is huge

Postby mpack » 30. Oct 2019, 13:45

Ahmed Haroon wrote:i have posted my VM for windows 7 for comparison which shows the .vdi size is near to the size of Used Space showing in properties

Like I said, the size is related to capacity and which sectors have been written to. Not on what the guest OS says is used by files.

Hint: sectors don't blank themselves when you delete a file in the guest.

Make sure the guest isn't writing to disk unnecessarily, e.g. background defrag, background indexing.
mpack
Site Moderator
 
Posts: 31397
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 6.0: vdi file size is huge

Postby socratis » 30. Oct 2019, 13:50

Ahmed Haroon wrote:it is very confusing and disturbing at least for me.
Let me give you an example...

VDI theoretical size = 50 GB.

Install guest OS with a 10 GB footprint:
  • VDI real size: 10 GB.
  • From the guest: 10 GB occupied, 40 GB free.
Create a huge 20 GB file in the Guest.
  • VDI real size: 30 GB.
  • From the guest: 30 GB occupied, 20 GB free.
Delete the huge file:
  • VDI real size: 30 GB.
  • From the guest: 10 GB occupied, 40 GB free.
Deleting a file from the Guest, does not auto-shrink the VDI. You got to do it while the VM is shut-down, following the procedure in the User Manual.

mpack wrote:Or, non-masochists can try the compact feature in CloneVDI.
Right!!!
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.
socratis
Site Moderator
 
Posts: 27690
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Virtualbox 6.0: vdi file size is huge

Postby Ahmed Haroon » 30. Oct 2019, 14:02

hey, thanks for detailed explanation to understand the situation :) will also check it on another machine, at the moment applying @socratis solution, hope this will help too.
regards
Last edited by socratis on 30. Oct 2019, 14:34, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
Ahmed Haroon
 
Posts: 12
Joined: 29. Mar 2019, 15:28

Re: Virtualbox 6.0: vdi file size is huge

Postby Ahmed Haroon » 31. Oct 2019, 07:51

hi all,

my feedback below:

it has been done easily with CloneVDI utility, simple, nice and fast too... :) the VDI size is about 15 GB out of 73 GB !!

first I have used with generate new UUID and when I rename to original one and used it as is, start machine but it showed my error for UUID which I have to investigate how to solve this problem. anyway, I deleted cloned vdi and create it again with keep old UUID, after create completion, rename it to original and start machine and it smoothly started :) after complete interface loaded, shutdown and export appliance to .ova file and its size is 6.5 GB which was 26.5 GB

is there anything else to check / verify? how I can handle the situation arise with NEW UUID?

thanks to all caring friends to help me, guide me to solve the problem :)

with warmest regards
Ahmed Haroon
 
Posts: 12
Joined: 29. Mar 2019, 15:28

Re: Virtualbox 6.0: vdi file size is huge

Postby socratis » 31. Oct 2019, 08:38

The recipe of the VM refers to the attached VDI(s) both by UUID and by filename.

  • If you want to simply replace the existing VDI in place, then keep the old UUID and the same filename. Then simply replace the old VDI with the clone VDI.

  • If you want to replace the VDI, then after you're done with CloneVDI, release the old VDI from the VM, and attach the new-clone to the VM. I would move the clone VDI to the same folder as the recipe, the .vbox file, in the VM's directory.
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.
socratis
Site Moderator
 
Posts: 27690
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Virtualbox 6.0: vdi file size is huge

Postby Ahmed Haroon » 31. Oct 2019, 09:14

thanks @socratis for reply
I tried your 2nd option and it was showing it as " inaccessible" ... was not showing sizes in Settings -> Storage -> Virtual Size and Accurate Size then I moved to option to Keep Old UUID in CloneVDI utility.
as per my problem mentioned in OP, i have to use only new Cloned vdi, so it works perfectly :)
regards
Ahmed Haroon
 
Posts: 12
Joined: 29. Mar 2019, 15:28

Re: Virtualbox 6.0: vdi file size is huge

Postby socratis » 31. Oct 2019, 13:25

Glad you got it going. Marking as [Solved].
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.
socratis
Site Moderator
 
Posts: 27690
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: No registered users and 30 guests