Virtualbox-Command-Line (VBoxHeadless.exe)
dsl.bat vdel.bat voff.bat vsave.bat
READ THE MANUAL FROM PAGE 84 on... http://mydebian.blogdns.org/?p=148
find the folder with the binaries/executables, e.g. c:\program files\sun\xVM VirtualBox Don't forget you need the right control key on the keyboard to "escape" from a virtualbox... Alt-F4 will kill the VM, all commands are case insensitive so CAPS is for easy reading
Create a VM, create a Virtual Hard Disk, Configure the VM to use the HD, Register an ISO image, Configure the VM to use the ISO Configure the other settings for the VM Start the VM, no GUI
//could be ... VBoxManage registervm
VBoxManage createvm -name VM1 -register
VBoxManage createhd -filename VM1.vdi -size 10000 -register
VBoxManage modifyvm VM1 -sata on -sataportcount 2 -sataport1 VM1.vdi
VBoxManage openmedium dvd /full/path/to/iso.iso
VBoxManage modifyvm VM1 -dvd /full/path/to/iso.iso
VBoxManage modifyvm VM1 -memory "256MB" -acpi on
VBoxManage modifyvm VM1 -boot1 dvd -nic1 bridged -bridgeadapter1 "Dell Wireless 1390 WLAN Mini-Card"
VBoxManage showvminfo VM1
PERFORMANCE TIPS
VBoxManage modifyvm VM1 -hwvirtex on VBoxManage modifyvm VM1 -nestedpaging on VBoxManage modifyvm VM1 -sata on -sataportcount 2 -sataport1 VM1.vdi VBoxManage modifyvm VM1 -ioapic on VBoxManage modifyvm VM1 -nictype1 82540EM
VBoxManage modifyvm -bioslogofadein off -bioslogofadeout on|off
Ubuntu server may require PAE (physical address extension) VBoxManage modifyvm VM1 -pae on
VBoxManage unregistervm "Windows XP" -delete
//you can bundle all of this into .bat/.sh files to quickly create/delete VM's //vdel.bat VBoxManage unregistervm %1 -delete
VIRTUALBOX "LIGHT" SESSION VIEW ONLY
vboxsdl -vm
//when started you won't be able to use that cmd window any more... //the VM can only be opened once, thus you'd have to define 2 VM's if you //want to run two VM's on the same host...
This is great if you have a DamnSmallLinux iso, e.g. a minimum VM script might look like:
//dsl.bat VBoxManage createvm -name "dsl" -register
VBoxManage modifyvm dsl -dvd e:\dsl-4.4.6.iso -bioslogofadein off -bioslogofadeout off -biosbootmenu disabled -nic1 intnet
echo "Remember the DSL boot is dsl 2 vga=771 lang=uk"
//get rid of that annoying logo thing and we don't want a boot menu (cdrom or hd) //sets up an a Network Card with cable connected on internal network intnet
//by default it does (MB) -vram 8 -memory 128
VBoxManage showvminfo dsl
vboxsdl -vm dsl
BUT be aware that if you do not force the display to fit you may end up resizing it alot... F2 or F3 boot options for damn small linux, txt w/ 800x640: dsl 2 vga=771
VBoxManage modifyvm dsl -vrdpport 3388 -vrdpauthtype null
VBoxHeadless -startvm dsl //could be
// If you are running windows and already have the services.msc terminal service // running you will get an error (because port 3389 is in use)
TO SEE YOUR VBoxHeadless machine (from a REMOTE machine)...
LINUX: rdesktop -a 16 my.host.address
WINDOWS: remote desktop: use the ip address for host address
or if you've enabled HostIf or NAT w/ forwarding to SSH then you could just SSH into your machine... or nxRemote or RDP...
ADVANCED The virtualbox RDP server supports multiple client connections into the same VM and multiple monitors... BUT you must be using a remote PC...
VBoxManage modifyvm WinXP -vrdpmulticon on VBoxManage modifyvm WinXP -monitorcount 2
VBoxManage controlvm
//voff.bat VBoxManage controlvm %1 poweroff
VBoxManage > VBoxManage-commands.txt
e.g. VBoxManage list [vms|runningvms|ostypes|hostdvds|hostfloppies|hostifs|hostinfo|hddbackends|hdds|dvds|floppies|usbhost|usbfilters|systemproperties]
vms tells you what virt machines, systemproperties tells you about the host (and max guests)
SNAPSHOTS
VBoxManage snapshot dsl take 2009 //takes a snapshot w/ name 2009, 20MB size
//Do some modifications, e.g. ifconfig eth0 10.0.2.1
VBoxManage snapshot dsl discardcurrent -state //reverts machine to previous state
VBoxManage snapshot dsl discard dsl-2009-02-14 //machine must be off...
VBoxManage snapshot
take <name> [-desc <desc>] //takes a snapshot w/ optional description
discard <uuid>|<name> //throws away a snapshot by name
discardcurrent -state|-all //reverts to most recent snapshot (-state)
edit <uuid>|<name>|-current //renames a snapshot
[-newname <name>]
[-newdesc <desc>] |
showvminfo <uuid>|<name> //shows the VM info of that snapshot
cleverly we can use this to skip any future booting... or even to create branches?
JUST REMEMBER that modifying the vM using VBoxManage MODIFYVM commands will also require booting from normal (e.g. vboxsdl -vm dsl) and then saving a new snapshot
//vsave.bat
echo off
SET thedate=%date% SET thetime=%time%
SET theyear=%thedate:~-4% SET themonth=%thedate:~3,2% SET theday=%thedate:~0,2%
SET thehour=%thetime:~0,2% SET themin=%thetime:~3,2%
SET filename=%1-%theyear%-%themonth%-%theday%--%thehour%-%themin%
VBoxManage snapshot %1 take %filename%
echo Saving %filename%
//vresume.bat VBoxManage snapshot %1 discardcurrent -state vboxsdl -vm %1
CLONE A VIRTUAL HARD DRIVE
vboxmange clonehd
//remember registers the "new" clone
RANDOM
IF you don't want to use your current vdrp server (e.g. remote desktop server) and instead prefer SSH
VBoxHeadless -startvm
-vdrp=config
VBoxAddIF