Server!/Horror! I have a magnet and I don't mind using it!

Scripting VirtualBox with VBoxManage

Well not really scripting. Merely a note on the basic usage of VBoxManage so that I can remember how to quickly create guest machines with lots of disks.

Get Basic Info About What We Need

VBoxManage list
VBoxManage list ostypes

Create a Guest and Register it to be visible in the GUI

VBoxManage createvm --name clitest --ostype Linux26_64
VBoxManage registervm ~/VirtualBox\ VMs/clitest/clitest.vbox
VBoxManage list vms

Adjust the settings

VBoxManage modifyvm clitest --vram 16
VBoxManage modifyvm clitest --memory 1024
VBoxManage modifyvm clitest --boot1 dvd --boot2 disk --boot3 none
VBoxManage modifyvm clitest --acpi on --ioapic on
VBoxManage modifyvm clitest --nictype1 virtio --nic1 bridged
# This is on Mac OS X so you might need to fiddle around with the name of --bridgeadapter1
VBoxManage modifyvm clitest --bridgeadapter1 en0:\ Ethernet --cableconnected1 on
VBoxManage modifyvm clitest --chipset ich9
VBoxManage modifyvm clitest --firmware bios

Create a disk to boot from

VBoxManageo vbm createhd --filename ~/VirtualBox\ VMs/clitest/root.vdi --size $((2**10 * 5))

Create a SATA Controller

VBoxManage storagectl clitest --name SATA\ Controller --add sata --sataportcount 2 --bootable on

Attach an ISO image and disk to the Guest

VBoxManage storageattach clitest --storagectl SATA\ Controller --port 0 --device 0 --type dvddrive --medium ~/ISOs/Fedora-13-x86_64-netinst.iso
VBoxManage storageattach clitest --storagectl SATA\ Controller --port 1 --device 0 --type hdd --medium clitest/root.vdi

Boot it

VBoxManage startvm clitest --type gui

Generated: 2017-11-02 10:20:47 +0100