. .

Create VM thru CLI

Sample command to create a VM in VirtualBox.

# list support OSTYPE
VBoxManage list ostypes

# create a new VM
VBoxManage createvm --name Win7_64 --ostype Windows7_64 --basefolder /home/vbox/VirtualBox --register

# modify the VM
VBoxManage modifyvm "Win7_64" --memory 1024 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth1 --vrde on --vrdeauthtype external --vrdeport 10081 --chipset ich9 --vram 128 --mouse usbtablet

# Create raw disk
VBoxManage internalcommands createrawvmdk -filename /home/vbox/VirtualBox/Win7_64/vm1.vmdk -rawdisk /dev/vlg1/vm1

# Attach a controller to the VM
VBoxManage storagectl Win7_64 --name 'SATA Controller' --add sata --controller IntelAHCI --sataportcount 4 --bootable on

VBoxManage storagectl Win7_64 --name 'IDE Controller' --add ide --controller PIIX4 --bootable on

# Attach the raw disk to vm
VBoxManage storageattach Win7_64 --storagectl 'SATA Controller' --port 0 --type hdd --medium /home/vbox/VirtualBox/Win7_64/vm1.vmdk

# Attach DVD-drive to vm
VBoxManage storageattach "Win7_64" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium emptydrive

VBoxHeadless startvm Win7_64