Saturday, July 23, 2016

VirtualBox from command line

Different VirtualBox operation from command line :

To know the Version of the VirtualBox
Command :
                vboxmanage -v
Sample Output:


To show the list of VMs:
Command :
                vboxmanage list vms
Sample Output :


To show the list of currently running VMs:
Command :
                vboxmanage list runningvms


To display the details of a specific VM
Command :
                vboxmanage showvminfo VM1
Sample Output :
* "VM1" is the name the VM
* The screenshot of Sample Output is NOT containing all the information.


To create a Virtual machine :
Command 1:
                vboxmanage createvm --name "VM2"
Sample Output :

After creating the VM, follow the below step to showed up in the "Oracle VM virtualBox manager"
Step 1- Select "Machine" menu.
Step 2- Click "Add" option.
Step 3- Browse to path of setting file
Step 4- Double click on "VM2.vbox" file
Now you can see the detail of VM2 as follows:


Command 2:
                vboxmanage createvm --name "VM2" --register
* --register option will register the VM with VirtualBox and hence this will enable us to display the recently created VM in "Oracle VM virtualbox manager" window.


To modify the settings of an already created VM
Command 1: [To modify the memory]
                vboxmanage modifyvm VM2 --memory 512
Command 2: [To assign the OS type]
                vboxmanage modify VM2 --ostype Ubuntu
Command 3:[To attach the SATA controller ]
                vboxmanage storagectl VM3 --name SATA -add sata --controller IntelAhci --bootable on
Command 4: [To attach the SATA (.vdi file)]
                vboxmanage storageattach  VM3 --storagestl SATA --port 0 --device 0 --type hdd --medium <path of the .vdi file>


To clone a Virtual machine :
Command 1 : 
                vboxmanage clonevm VM1_CPU --name VM1_IO --register
Sample Output :



 To control the network bandwidth 
Command :
                1. vboxmanage bandwidthctl VM1 add Limit --type network --limit 100k
                2. vboxmanage bandwidthctl VM1 set Limit --type network --limit 100k











No comments:

Post a Comment