Posts Tagged ‘Virtualization’

How to shrink a VirtualBox vdi disk image size?

Monday, July 26th, 2010

Virtual disk images (.vdi files) tend to grow over time, especially with windows guest systems, and may quickly consume all your disk space on the host system.

This post shows the required steps to free up the unused space. It worked for me with Sun/Oracle VirtualBox versions of 3.1.6 and above.

For a Windows guest system

  • Start a Defragmentation (right-click disk icon, select properties->Tools tab-> Defragment now…)
  • Download Sdelete (about 47kb) into your guest.
    Wait for the defragmentation to complete.
  • Fill the free space of your vdi disk image with zeros executing

    sdelete -c

    from a DOS command line.
    This may take a lot of time (30min for a 20GB disk on my system).

    Don’t use the guest system during the process

  • Shut down your windows guest system.
  • Make a backup of your .vdi file.
  • On your HOST system, execute the following command in a DOS/terminal window:
    VBoxManage modifyhd diskname.vdi> --compact

    The VBoxManage tool is part of the VirtualBox standard distribution.

While I tried this only for .vdi files, it should work the same way for .vdmk files. The point is that the –compact option sorts out all sectors that are filled with zeros.

Enjoy!

Install VirtualBox Guest Additions in CentOS (RedHat) Linux Guest

Tuesday, September 22nd, 2009

When you try to install the VirtualBox Guest Additions for a Linux guest system, this will fail due to some weired ‘features’ in the installation. This post is based on my experience with VirtualBox 3.0.6.

To perform the installation do the following:
Choose Install Guest Additions... from the VirtualBox menu. Open a terminal window in your guest system. Do a

cd /media/VBOXADDITIONS_3.0.6_52128/
(the foldername will change depending on the VBox version). Proceed as described below.
(more…)