VirtualBox
References
Online help on Mac OS X opens the following PDF document, which contains a very useful reference:
/Applications/VirtualBox.app/Contents/MacOS/UserManual.pdf
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 Preferences.app" 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 = 192.168.1.8
- Subnet mask = 255.255.255.255 (not the usual 255.255.255.0, 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 VirtualBox.app 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):
# SSH /Applications/VirtualBox.app//Contents/MacOS/VBoxManage setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP /Applications/VirtualBox.app//Contents/MacOS/VBoxManage setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22 /Applications/VirtualBox.app//Contents/MacOS/VBoxManage setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222 # HTTP /Applications/VirtualBox.app//Contents/MacOS/VBoxManage setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP /Applications/VirtualBox.app//Contents/MacOS/VBoxManage setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80 /Applications/VirtualBox.app//Contents/MacOS/VBoxManage setextradata debian-lenny "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 8080
Note:
- 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