VDI disk size is keep on increasing

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Arul
Posts: 4
Joined: 30. Jun 2017, 05:34

VDI disk size is keep on increasing

Post by Arul »

Hi,
I am using a Oracle VM box for the past one year. my virtual hard disk space is keep on increasing rapidly. Earlier when i installed the VM box it was around 30 GB now it reached 53 GB disk space. but the actul size in windows of VDI is 40 GB. I want to know how the VDI file size is getting increased than the assigned memory space.
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: VDI disk size is keep on increasing

Post by socratis »

Arul wrote:I want to know how the VDI file size is getting increased than the assigned memory space.
I want to know that too, because that would be a miracle... ;)

Go to File » VirtualBox Media Manager. Find your disk. There are two values, "Virtual Size" and "Actual Size". What are their values? Also, if the disk has a triangle to the left of its name, expand it. What does it look like?
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.
Arul
Posts: 4
Joined: 30. Jun 2017, 05:34

Re: VDI disk size is keep on increasing

Post by Arul »

Hi Socratis,
I have attached an image please look into that. Currently my disk space is 80GB and Actual size is 53GB.
Attachments
VDI_Query.PNG
VDI_Query.PNG (16.66 KiB) Viewed 7122 times
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VDI disk size is keep on increasing

Post by mpack »

In your first post you said you created a 40GB disk. Clearly the image shows that the disk in fact has an 80GB capacity. 53GB is less than 80GB, so the image shows nothing out of the ordinary.

To answer the original question: dynamic disks grow when the guest OS writes to previously unused portions of the disk. So if the VDI keeps growing then it must be writing to new sectors. Look to the apps in your guest OS to see if any of them are continually touching the drive.

Or, this could all be nothing more than reflecting your own usage patterns. If you download a lot of stuff then yes, the drive will probably keep growing - though normally slower and slower, until it reaches the maximum you set (80GB).

Btw, don't let some idiot blogger persuade you to switch to fixed disk. If you did that then an empty drive would occupy 80GB from day one, and I fail to see how that's an improvement!

Oh: and if you use a guest tool to report the partition size then do remember that drives can have more than one partition. Linux drives in particular usually have at least one main partition plus a swap partition which is normally invisible to you, though setting aside 40GB for a swap partition strikes me as a bit profligate. Use a guest partitioning tool to see what partitions exist on the drive.
Arul
Posts: 4
Joined: 30. Jun 2017, 05:34

Re: VDI disk size is keep on increasing

Post by Arul »

VM VDI properties.JPG
VM VDI properties.JPG (28.51 KiB) Viewed 7060 times
Hi,
That's a quite impressive response and useful as well. I just want to bring up this issue i am facing right now. It is like in my VM it is showing 40 GB in windows. but the VDI file is showing 54 GB.
Attachments
VDI.PNG
VDI.PNG (33.93 KiB) Viewed 7060 times
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: VDI disk size is keep on increasing

Post by socratis »

Arul wrote:my VM it is showing 40 GB in windows
Where exactly did you see that 40GB you're referring to? Are you referring to the 38.4 GB that the disk is occupying in your VM? And you expected that exact number to be reflected on the host?

I'm sorry, but that's not how things work. Here's a quick test; in your VM create a 20GB file, then delete it. What do you think is going to happen in the VDI on the host? Is it going to regain that 20 GB? Answer: no, it's not. The "sectors" have been occupied, and that's all that the VDI cares about. That's actually how your real OS works. It doesn't "delete" those used sectors, it simply declares them unused.

If you want to reclaim the once used disk space, there is an option to compact the VDI. See ch. 8.23 VBoxManage modifymedium and especially the "--compact" option, after having taken appropriate steps to zero-declare the free disk sectors.
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.
Arul
Posts: 4
Joined: 30. Jun 2017, 05:34

Re: VDI disk size is keep on increasing

Post by Arul »

thank you so much. Hope this works
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VDI disk size is keep on increasing

Post by mpack »

socratis wrote: If you want to reclaim the once used disk space, there is an option to compact the VDI. See ch. 8.23 VBoxManage modifymedium and especially the "--compact" option, after having taken appropriate steps to zero-declare the free disk sectors.
I appreciate that this is the official response, but I'm sorry - the official method is a terrible way to compact a drive, being slow, unsafe, and error prone. The OP is using a Windows host, so he can easily use CloneVDI for this, and be done in 5 minutes instead of 50, skipping all that guff about zero filling the filesystem - which risks maxing out host disk space.

Also, I'd point out that compaction is appropriate after a one off event, but if the size increases are due to the users continuing habits then he's just going to put the weight right back on again.

The title of this topic is misleading (VDIs do not "keep on increasing"), and the information given was mistaken (the OP has an 80GB drive, not 40GB), and compaction may not be appropriate for the reason just given, so, I've yet to be convinced that anything needs fixing at all.
Post Reply