Posts Tagged ‘VirtualBox’

HowTo: Shrink a dynamic VirtualBox Image

March 4th, 2011 No comments

My WinXP *.vmdk Image had >17 GB, but only ~11 GB were used in the virtual machine. This is a little problem, especially for copy or backup operations.
A post in the VirtualBox forum was the solution, subsection “Q: How can I reduce the size of a dynamic VDI on disk?”. This HowTo is for *.vdi files, if you have a *.vmdk, like me, you can convert it via

VBoxManage clonehd *.vmdk *.vdi --format VDI

before the last step of the HowTo. Maybe you can skip the `VBoxManage modifyhd *.vdi –compact` command, if you need to clone the *.vmdk. (The cloning did also compress the image in my case.)

Categories: software Tags: , ,

Access VirtualBox VM behind NAT

November 3rd, 2010 No comments

VirtualBox uses NAT if not configured otherwise. Heres an example on how to configure VirtualBox to portforward port 2222 on the Host to port 22 on the VM-Client to access the ssh-server inside the vm-linux. The VirtualBox is called Ubuntu.10.10.32bit in the example:

VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

Make sure that you actually use the pcnet driver – mine on my mac is e1000 – just look into the VBox.log to see which one is used.

Shutdown the VM and close VirtualBox for the changes to take effect.

List all set items with
VBoxManage getextradata Ubuntu.10.10.32bit enumerate

Deleting an item can be done with setting a property without giving a value, e.g.
VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort"

Categories: software Tags: