Claim Unused Space on Guest

Discussions related to using VirtualBox on Windows hosts.
Post Reply
doracle
Posts: 5
Joined: 30. Dec 2008, 02:14
Location: San Francisco

Claim Unused Space on Guest

Post by doracle »

Hi
I could not find much info on this topic on the forums or manual. This is a general question, even though I am posting it in this forum.

Basically I have a VDI which uses 350GB. It has a bunch of applications installed, and works great.
However I would like to claim around 200GB which is unused by the guest, and give it back to the Host (Windows XP in my case is the Host and RedHat is the Guest).

Any pointers would be appreciated.

Yes... I agree it was bad space planning on my part to block 350GB :-(

- D
Hypnoz
Posts: 7
Joined: 4. Jan 2009, 07:21

Post by Hypnoz »

I had this same issue after adding and removing several GB of data from my linux VM.

You will need a utility called "zerofree" and need to know how to boot into init 1 (single user mode)

I used this tutorial, and it worked perfectly for me and caused no issues to my VM after running it.

http://ubuntuforums.org/showthread.php?t=908172


If you're wondering what it does, basically after deleting files the data in the VM isn't set to null 0 values, it still holds the space as used until it is overwritten. The zerofree utility overwrites any files that were deleted on the VM file with zeros, which allows the VBoxManage compact command to know which sectors are safe to compress.

Hope this helps! :)
Hypnoz
Posts: 7
Joined: 4. Jan 2009, 07:21

Post by Hypnoz »

An update to my last post. It seems with the new 2.1.0 version, some people are having issues with the last command in that write up, which calls VBoxManage modifyvdi

You may want to read through this thread before going through the process.

http://forums.virtualbox.org/viewtopic.php?t=12383

Looks like some people might be having luck doing clonevdi instead of modifyvdi after zeroing out the empty space?
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

There is also my tutorial All about VDIs. :-)
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
doracle
Posts: 5
Joined: 30. Dec 2008, 02:14
Location: San Francisco

Post by doracle »

Thanks for your responses.
I am on 2.0.6 and cannot move to 2.1 because of the port-forwarding issue on WINXP

TerryE: your tutorial is informative, however I should have mentioned that my VDI is "normal" fixed-size".

I am trying out the other options available.

- D
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

Post by Sasquatch »

doracle wrote:TerryE: your tutorial is informative, however I should have mentioned that my VDI is "normal" fixed-size".
There was a user who had that too, and after issuing the modifyvm compact command, it changed it to a dynamic VDI and actually shrunk the file.
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.
Post Reply