LinuxCommandLibrary

VirtualBox

Run virtual machines

SYNOPSIS

VBoxManage <command> [<args>...]

Examples:
VBoxManage list vms
VBoxManage createvm --name MyVM --ostype Ubuntu_64 --register
VBoxManage modifyvm MyVM --memory 2048 --cpus 2
VBoxManage startvm MyVM --type headless
VBoxManage controlvm MyVM savestate

PARAMETERS

list
    Lists various VirtualBox objects like registered VMs, running VMs, host information, host-only network interfaces, etc. E.g., list vms, list runningvms.

createvm
    Creates a new virtual machine definition. Requires parameters such as --name for the VM's name and --ostype for the operating system type. Often used with --register to make it known to VirtualBox.

registervm
    Registers an existing VM from its .vbox file, making it accessible to VirtualBox.

unregistervm
    Unregisters a VM. Optionally, --delete can be used to delete all associated files.

modifyvm
    Modifies the settings of a registered VM. This command has a vast array of options to configure memory, CPUs, network adapters, video memory, boot order, and many other hardware aspects. E.g., --memory, --cpus, --nic1.

startvm
    Starts a registered VM. The --type option specifies the frontend, e.g., gui, headless, or separate.

controlvm
    Controls a running VM. Actions include poweroff, reset, savestate, pause, resume, and acpipowerbutton.

snapshot
    Manages VM snapshots. Allows take, restore, delete, list, and showvminfo for snapshots.

storageattach
    Attaches a storage device (e.g., virtual hard disk, CD/DVD drive, floppy) to a VM's storage controller. Requires controller and port specifications.

storagectl
    Adds or modifies a storage controller (e.g., SATA, IDE, SCSI, SAS, NVMe) for a VM.

createmedium
    Creates a new virtual disk image (e.g., VDI, VHD, VMDK). Options include --filename, --size, and --format.

closemedium
    Closes a medium (removes it from the Virtual Media Manager), optionally deleting the file.

sharedfolder
    Manages shared folders for a VM. Allows add, remove, and list operations.

hostonlyif
    Manages host-only network interfaces. Allows create, remove, ipconfig, and dhcpserver configuration.

dhcpserver
    Manages DHCP servers associated with host-only networks. Allows add, remove, modify, and start/stop.

setextradata
    Sets extra data values globally or for a specific VM, useful for custom settings or scripting.

export
    Exports a VM to an OVF or OVA appliance file, facilitating VM portability.

import
    Imports a VM from an OVF or OVA appliance file.

hostinfo
    Displays various information about the host system and its VirtualBox installation, such as CPU details, memory, and installed extensions.

setproperty
    Sets a global VirtualBox property, like the default machine folder or specific settings for the VRDP server.

DESCRIPTION

The VBoxManage command is the powerful, feature-rich command-line interface to Oracle VM VirtualBox. It allows users to control every aspect of VirtualBox, from creating and configuring virtual machines (VMs) to managing snapshots, network settings, and storage. It is indispensable for automating tasks, scripting VirtualBox operations, and managing VMs on headless servers where a graphical user interface is unavailable or undesirable. With VBoxManage, you can start, stop, pause, and reset VMs, modify their hardware settings like memory and CPU, attach virtual disks, configure networking, and perform import/export operations, making it a crucial tool for system administrators and developers working with VirtualBox environments.

CAVEATS

Using VBoxManage requires the VirtualBox software to be installed on the system. Users typically need to be part of the vboxusers group to have the necessary permissions to manage VMs. Incorrectly configured commands or parameters can lead to data loss or VM corruption. Due to the extensive number of options and subcommands, consulting the official VirtualBox documentation or VBoxManage --help for specific commands is highly recommended.

SCRIPTING AND AUTOMATION

VBoxManage is invaluable for scripting and automating VirtualBox operations. Its command-line nature allows integration into shell scripts (Bash, PowerShell) to create, configure, start, stop, and manage VMs programmatically, which is essential for CI/CD pipelines, automated testing, and cloud provisioning.

HEADLESS OPERATION

For server environments or running VMs in the background without a graphical interface, the --type headless option with startvm is crucial. This allows VMs to run without consuming desktop resources for a GUI, making them ideal for hosting services or running background tasks.

HISTORY

VirtualBox was originally developed by Innotek GmbH. It was first released in 2007. In 2008, Sun Microsystems acquired Innotek, bringing VirtualBox under their umbrella. Following Oracle Corporation's acquisition of Sun Microsystems in 2010, VirtualBox has continued its development and maintenance under Oracle, becoming a widely used virtualization solution for desktop and server environments across various operating systems.

SEE ALSO

qemu-system-x86_64(1), virsh(1), kvm(1), systemctl(1)

Copied to clipboard