The simplest way to start VM on VirtualBox is a GUI. You have to click ‘Start’ and that’s all. What if you want to control your machines from a shell script? You have to use VBoxManage tool. It offers a really huge set of commands:
VBoxManage startvm VBoxManage list VBoxManage showvminfo VBoxManage controlvm VBoxManage addiscsidisk VBoxManage adoptstate VBoxManage clonehd VBoxManage closemedium VBoxManage convertfromraw VBoxManage createhd VBoxManage createvm
and more.
In this example we will use only the first – VBoxManage startvm and the second VBoxManage list.
Let’s see all virtual machines:
$ vboxmanage list vms Oracle VM VirtualBox Command Line Management Interface Version 3.2.10_OSE (C) 2005-2012 Oracle Corporation All rights reserved. "vm1" {a1bc53b9-5b7a-4a72-81c2-bb34ebcf4041} "vm2" {f25d5dde-4479-4740-9308-b3add90fa642} "vm3" {00f75185-a85b-4db6-8012-0003cacb5963}
And all running VMs:
$ vboxmanage list runningvms Oracle VM VirtualBox Command Line Management Interface Version 3.2.10_OSE (C) 2005-2012 Oracle Corporation All rights reserved. "vm1" {a1bc53b9-5b7a-4a72-81c2-bb34ebcf4041}
We will start vm2.
$ vboxmanage startvm vm2 Oracle VM VirtualBox Command Line Management Interface Version 3.2.10_OSE (C) 2005-2012 Oracle Corporation All rights reserved. Waiting for the VM to power on... VM has been successfully started.
This operation opens VM console window. We can start VM without that window using –type=headless option.
$ vboxmanage startvm vm2 --type=headless Oracle VM VirtualBox Command Line Management Interface Version 3.2.10_OSE (C) 2005-2012 Oracle Corporation All rights reserved. Waiting for the VM to power on... VM has been successfully started.