Author Topic: How to shrink the Increasing size of Virtual Box-SOLVED  (Read 1179 times)

Offline shrinivas

  • Full Member
  • ***
  • Posts: 154
How to shrink the Increasing size of Virtual Box-SOLVED
« on: February 17, 2011, 12:37:05 AM »
I did not find any topic on this, so I am posting here. If it has already been answered, please guide me to that post.

I have installed WinXp in a virtual drive, its size was less than 2 GBs, after all the required programs were installed and so it showed a similar size in the properties in .virtualbox.

Later, I downloaded some iso's for a few GB's , and the size in .virtualbox increased by a similar magnitude.

I removed those iso's from the WinXp through shared folders, but the size of virtual drive has remained the same.

In fact, now it is about 4 GBs on account of this. ( The size of the WinXp inside the virtualbox is less than 2 GB's.)

Is there any way to correct this ? It is not a problem as far as working is considered, but when I try to create a mylivecd, its size may pose a problem.

(One way would be to make a copy of the first fully installed copy of the virtual disk and keep it somewhere else and copy it back when the size balloons.)
If there is another way, please let me know, I am a newbie, so CLI scares me !

Regards and thanks.

« Last Edit: February 17, 2011, 05:47:26 PM by shrinivas »
AMD ATHLON 64X2 5200, 2 GB RAM, nVidia 7600GT 256 RAM, HD0 320GB,HD1 80GB Triple-boot PCLinuxOs Zen Mini/WinXp/E17

smcs_steve

  • Guest
Re: Increasing size of Virtual Box
« Reply #1 on: February 17, 2011, 03:25:33 AM »
Hello shrinivas,
This sounds familiar...  try>
Quote
OK - I tried the VDI clone utility and it works a treat! - simple GUI allows generating new UUID (or keeping old), Increasing virtual drive size, and Compact drive while coping.

http://www.pclinuxos.com/forum/index.php/topic,67713.msg551806.html#msg551806
and
http://forums.virtualbox.org/viewtopic.php?f=6&t=22422[CloneVDI%20tool/
>Steve
« Last Edit: February 17, 2011, 03:28:55 AM by _steve »

Offline GermanTux

  • Hero Member
  • *****
  • Posts: 693
Re: Increasing size of Virtual Box
« Reply #2 on: February 17, 2011, 08:34:06 AM »
Try this link

Of note: I am assuming that you are using thin provisioning on your VDI file, and that is why it is growing with more data

Offline shrinivas

  • Full Member
  • ***
  • Posts: 154
Re: Increasing size of Virtual Box
« Reply #3 on: February 17, 2011, 10:05:16 AM »
Respected _steve and German Tux,
I have read your replies and shall look into them.

German Tux: what is thin provisioning ? I have selected Dynamically expanding HDD set up to 10 GB.

steve : I have downloaded the zip file, ( honestly I couldn't make head or tail of it !) I believe it is for Win host, whereas my host is PCLinuxOs and guest is WinXp

Thanks and regards
AMD ATHLON 64X2 5200, 2 GB RAM, nVidia 7600GT 256 RAM, HD0 320GB,HD1 80GB Triple-boot PCLinuxOs Zen Mini/WinXp/E17

Offline ElCuervo

  • Hero Member
  • *****
  • Posts: 4148
  • I'm walking on sunshine!
Re: How to shrink the Increasing size of Virtual Box
« Reply #4 on: February 17, 2011, 10:23:42 AM »
If you are downloading big files such as ISOs in Windows and storing them there, try moving them to your Linux partition using Shared Folders instead. I would give you more details, but VBox has step-by-step pop-up balloons that tell you how to do it. Just go to the main window and start looking at the Shared Folders on the menu.
"If there were no change, there would be no butterflies" - Walt Disney

http://linuxcounter.net/cert/433721.png

Offline pags

  • Hero Member
  • *****
  • Posts: 2517
  • Keep it clean.
Re: How to shrink the Increasing size of Virtual Box
« Reply #5 on: February 17, 2011, 10:30:03 AM »
The link from GermanTux is correct, if not a little sparse and with possible typographic errors...

Try these steps:

**First, on the Windows guest:
1) Clean up the drive.  Remove any un-needed, temporary, extraneous, etc files.  Empty the Trash.  Generally get rid of as much as you can (and are comfortable with).  The space in use as reported by Windows will be your goal.
2) De-frag the (virtual) drive.  It doesn't hurt to run it few time (it will continue to compact the files a little better each time).  You don't need to run it an excessive (+5) number of times. ;)
3) Download sdelete (you can get it here: http://download.sysinternals.com/Files/SDelete.zip)
4) from a command (or DOS) prompt in Windows, run the sdelete program as follows:
Code: [Select]
sdelete -c c:
This will "zero-out" all the deleted (and, hence, un-used) files/space on you Windows install, allowing the next steps to proceed
5) Shut down (not Hibernate) Windows.

**Second, on the PCLinuxOS host:
6) From a console (command prompt) run the following:
Code: [Select]
VBoxManage modifyhd /full/path/to/.VirtualBox/HardDisks/Windows.vdi --compact
--Replace "/full/path/to/.VirtualBox/HardDisks/Windows.vdi" with the proper path and filename for your Windows virtual disk.



After this is done running, the size of your .vdi should be much closer to the size Windows reported as in use.

If you don't want to change your original HD (good for copies, backups, etc), replace "modifyhd" with "clonehd", and supply and output file.
Code: [Select]
VBoxManage
by itself will print out all its options.

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1628
  • UK MLU
Re: How to shrink the Increasing size of Virtual Box
« Reply #6 on: February 17, 2011, 10:31:52 AM »
shrinivas

I also have a 10g XP installation in VirtualBox on a dynamically expanding HDD

I manage the size in much the same way as the link provided by GermanTux above, though I use nullfile from here to zero the unused parts of the disk.

in order for the process to be effective you will need to run the windows defrag routine before using nullfile or sdelete

EDIT
Hmm typing a little faster than I am there pags, never hurts to re-iterate I guess ;D
« Last Edit: February 17, 2011, 10:33:52 AM by 7272andy »


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline pags

  • Hero Member
  • *****
  • Posts: 2517
  • Keep it clean.
Re: How to shrink the Increasing size of Virtual Box
« Reply #7 on: February 17, 2011, 10:32:26 AM »
If you are downloading big files such as ISOs in Windows and storing them there, try moving them to your Linux partition using Shared Folders instead. I would give you more details, but VBox has step-by-step pop-up balloons that tell you how to do it. Just go to the main window and start looking at the Shared Folders on the menu.

Downloading in Windows will still create temporary files (while downloading) before copying to the Shared Folder (well, actually, IE will...I think Firefox is better than that).
Anyway, it may be easier to just download them from Linux into the Shared Folder, and then access them from Windows through that.

Having said that, it is still beneficial to be able to reduce the size of the VM's harddisk...

Offline GermanTux

  • Hero Member
  • *****
  • Posts: 693
Re: Increasing size of Virtual Box
« Reply #8 on: February 17, 2011, 12:31:08 PM »

German Tux: what is thin provisioning ? I have selected Dynamically expanding HDD set up to 10 GB.


Shrinivas, thin provisioning is the same as dynamically expanding disks, just a different terminology (VMWare's to be exact). 

Offline shrinivas

  • Full Member
  • ***
  • Posts: 154
Re: How to shrink the Increasing size of Virtual Box
« Reply #9 on: February 17, 2011, 05:43:40 PM »
Thanks all !
I will do all these things and report back.
It may take time because of my limited broadband connection and time-difference, so please bear with me.
I am grateful for all the help I got on this wonderful forum !
Regards and thanks once again !
For now I will mark this "SOLVED" as I have got all the help needed.
« Last Edit: February 17, 2011, 05:46:59 PM by shrinivas »
AMD ATHLON 64X2 5200, 2 GB RAM, nVidia 7600GT 256 RAM, HD0 320GB,HD1 80GB Triple-boot PCLinuxOs Zen Mini/WinXp/E17