command line

Running VMs

List your VMs

vboxmanage list vms

Register a new VM (such as one you just copied to the server)

vboxmanage registervm ~/VirtualBox\ VMs/Ubuntu\ 13.10/Ubuntu\ 13.10.vbox

Modify a VM (such as turning off 3D acceleration on the box you just copied over, and turning on Remote Desktop to the Console)

vboxmanage modifyvm "Ubuntu 13.10" --accelerate3d off
vboxmanage modifyvm "Ubuntu 13.10" --vrde on

Start a VM
(Alternatively, you can start a VM with the VBoxHeadless command so you can see more detailed error output, the the below is best)

vboxmanage startvm "TDI4" --type headless

See what port RDP is running on

vboxmanage showvminfo TDI4 | grep "VRDE"

Turning on RDP access (If it was turned off when you started the VM - this fails to work on some versions and you must turn on above before you start the VM)

VBoxManage controlvm "TDI4" vrde on vrdeport 3391

Get the IP it's listening on

vboxmanage guestproperty get "RedCAP_Test" "/VirtualBox/GuestInfo/Net/0/V4/IP"

Shut down the VM (safely)

VBoxManage controlvm "Ubuntu 13.10" acpipowerbutton

Running Multiple VMs

If you've started multiple VMs and not specified the vrdeport in advance, you will only be able to access the first one you started until you change the others. Use the controlvm command to do this after they are running (you cannot specify it as a startup parameter, only as a property)

vboxmanage startvm "TDI1" --type headless
vboxmanage startvm "TDI2" --type headless
vboxmanage startvm "TDI3" --type headless

# TDI1 grabbed the default port of 3391
vboxmanage controlvm TDI2 vrdeport 3392
vboxmanage controlvm TDI3 vrdeport 3393

Extending a Hard Drive

vboxmanage list hdds  

UUID:        0d7631d6-a08e-4769-ae48-c9487e5b20e6                <------ This is the UUID
Parent UUID: base
Format:      VDI
Location:    /home/allen/VirtualBox VMs/TDI4/TDI4.vdi
State:       created
Type:        normal
Usage:       TDI4 (UUID: 2b657b6a-24c9-4ed1-852c-129a1a161349)   <------ Not this one


VBoxManage showhdinfo 0d7631d6-a08e-4769-ae48-c9487e5b20e6

UUID:                 0d7631d6-a08e-4769-ae48-c9487e5b20e6
Accessible:           yes
Logical size:         20480 MBytes
Current size on disk: 20139 MBytes
Type:                 normal (base)
Storage format:       VDI
Format variant:       dynamic default
In use by VMs:        TDI4 (UUID: 2b657b6a-24c9-4ed1-852c-129a1a161349)
Location:             /home/allen/VirtualBox VMs/TDI4/TDI4.vdi

(to add 10G add 10240MB (10*1024 to) the logical size above
VBoxManage modifyhd 0d7631d6-a08e-4769-ae48-c9487e5b20e6 --resize 30720

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Adding RAM

VBoxManage showvminfo "TDI4" | grep Memory
Memory size:     1024MB

VBoxManage modifyvm "TDI4" --memory "2048"

Comments