Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running Oracle VM VirtualBox (Ver: 3.2.8). Inside my VirtualBox, I used to run a Ubuntu OS. Whenever I create a file or folder containing large data (sometimes the size goes up to 1GB) the disk space increases automatically. If I check the file size (the vdi file size which is kept in a separate partition) from Windows XP it shows the incremented size of the vdi file.

If I (permanently) delete any folder of size 1GB, it is not reflected in disk space. This means from Windows, if I get the vdi file properties it does not show the increase in free space even though I have deleted a 1GB folder permanently from Ubuntu OS.

If a issue the command df -h in Ubuntu, it is showing the right thing.

Is the issue related to VirtualBox? Is there a fix?

share|improve this question

1 Answer 1

I've done the same thing and observed the same behavior. I believe that this behavior is by design.

Dynamic expansion is promised

The "Create new disk" wizard states, under the "Fixed-size storage" section:

The creation of a fixed-size storage [sic] may take a long time depending on the storage size and the write performance of your harddisk.

One reason for the dynamically expanding partition is that creating, say, a 32 GB file on the host for the virtual machine takes a long time.

Dynamic expansion is useful

Therefore, pretending that the file is actually 32 GB until it actually needs to be that large is useful; you don't want to wait a long time to create a new machine if you're only going to use the first 2 or 3 GB when you install the OS and start it up.

Dynamic expansion does happen

This works as expected, as you and I have observed.

Dynamic shrinking is not promised

Again, the wizard states:

A dynamically expanding storage initially occupies a very small amount of space on your physical hard disk. It will grow dynamically (up to the size specified) as the Guest OS claims disk space.

Nowhere in this paragraph does the software suggest that the disk will ever shrink.

Dynamic shrinking is not useful

Having a dynamically shrinking partition is less useful. It would not result in a significant space or time savings. When you create a dynamic partition, you're making a contract with the guest OS that the hard drive will expand to the stated maximum size if and when it needs it. Dynamically resizing the drive to be smaller and using the space savings would create a conflict later when the guest OS needs to create a large file, perhaps when building a swap space for hibernation.

Dynamic shrinking does not happen

Again, you and I have both observed that this does not occur.

Conclusion

For these reasons, I conclude that you are getting the correct file size, and it's almost certainly correct. You can create 1 GB files as often as you like, but their removal will not decrease the size of the virtual disk.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.