Useful tool and commands
- Add ssh support for a virtual machine

#> VBoxManage setextradata "" "VBoxInternal/Devices/e1000/0/LUN#0/Config/dienstName/Protocol" TCP 
#> VBoxManage setextradata "" "VBoxInternal/Devices/e1000/0/LUN#0/Config/dienstName/GuestPort" 22
 #> VBoxManage setextradata "" "VBoxInternal/Devices/e1000/0/LUN#0/Config/dienstName/HostPort"
e1000 is the name of the network adapter which is used
or use this
#> VBoxManage modifyvm "" --natpf1 "guestssh,tcp,,8022,,22"
- Resize virtual harddisk to 20GB

#> VBoxManage modifyhd .vdi --resize 20000
- Mount vdi image
Do it as root or with sudo#> modprobe nbd max_part=16
 #> qemu-nbd -c /dev/nbdX 
#> mount /dev/nbdXpY
when you finished

#> umount /mnt/ 
#> qemu-nbd -d /dev/nbdXls
- Compacting VirtualBox Disk Images
- Windows Guests
- Delete Unnecessary Files
- Defragment the Disk
- Clean any free disk space
Download sdelete: http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx
Start a DOS prompt:C:\> sdelete.exe -z c:
-z: zero any free space.
C:\> sdelete.exe -c c:
-c clean any free space.
- Shutdown guest image
- Compact the Windows guest image
VBoxManage modifyhd --compact ".vdi
- Linux Guest
- Clean any free disk space
dd if=/dev/zero of=zerofillfile bs=1M
- When the dd is completed, you will see a message that there is no space left on the device
dd: writing 'zerofillfile': No space left on device
- Remove zerofillfile
rm zerofillfile
- Shutdown the Linux Virtual Machine
- Compact the Linux guest image
VBoxManage modifyhd --compact .vdi
- Clean any free disk space
- Windows Guests