From HerzbubeWiki
Jump to: navigation, search


Online help on Mac OS X opens the following PDF document, which contains a very useful reference:


Shrink hard disk image size

A dynamically growing hard disk image will never shrink automatically. It can be shrunk manually like with this command

VBoxManage modifyhd foo.vdi --compact

To have any effect, the empty areas that can be shrunk must be filled with 0 (zero) bytes. The Virtual Box manual section that covers the VBoxManage modifyhd command has some hints how this can be achieved. Here is an excerpt of what I have used:

  • On Windows use the sdelete command line utility from Microsoft. This utility is part of the Sysinternals Suite, but can also be downloaded separately. Just search the net for "sdelete" and you will find the official download link. The utility can be run like this in 2 passes (not sure if the "-c" pass is necessary)
sdelete -c c:
sdelete -z c:

Networking between Mac OS X / Linux Guest while host is offline

Host offline = Host is not connected to any external network.

Configure Mac OS X with a static IP address:

  • Launch "System" and open the "Network" preference pane
  • Create a new environment called "static"
  • Select the "Ethernet (integrated)" service
  • Set the configuration mode to "Manual"
  • IP Address =
  • Subnet mask = (not the usual, because that would require an external gateway, i.e. router, which we don't have since the host is offline)
  • Leave "Router", "DNS Server" and "Search domains" empty

Configure the Linux guest (e.g. "debian-lenny") in the GUI as follows:

  • Edit the guest machine
  • On the "Network" tab, enable Adapter 1
  • Adapter Type must be one of the PCnet types (otherwise the command line configuration below will not work)
  • Attached to = NAT (for the host it will appear as if is the originator of all networking requests)

Configure the Linux guest on the command line as follows (information taken from the VirtualBox user manual PDF document):

/Applications/ setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
/Applications/ setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
/Applications/ setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
/Applications/ setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP
/Applications/ setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80
/Applications/ setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 8080


  • Command line configuration is possible only while the guest is stopped
  • Host ports must be >1000; Mac OS X requires root access for ports <=1000