VirtualBox

1.DePs For Ubuntu/CentOS To install VirtualBox
=======================================


# apt-get install linux-headers-$(uname -r) build-essential  dkms
# yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel \
kernel-headers kernel-devel dkms


2.Install Extension-Pack
====================


add the user that will run VirtualBox (sysadmin in this example) to the vboxusers group:

# adduser sysadmin vboxusers

# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.18-78361.vbox-extpack



3.Starting A VM With VBoxHeadless
===============================


Regardless of if you create a new VM or import an old one, you can start it with the command:

# VBoxHeadless --startvm "Ubuntu 12.04 Server"

To list of available VMs
# vboxmanage list vms

To start machine
# vboxmanage startvm vmname --type headless

4.Power off  virtual machine using the command
========================================


# VBoxManage controlvm "Ubuntu 12.04 Server" poweroff



5.Clone HardDisk
================


# VBoxManage clonehd /Vbox/oldxp.vdi  /Vbox/newxp.vdi

6.Change UUID of VDI Dusk
=======================


C:\ >  VBoxManage internalcommands sethduuid "C:\Users\Name\VirtualBox VMs\Example\Example.vdi"  --- Windows

# VBoxManage internalcommands setvdiuuid /path/to/virtualdisk.vdi   --- LInux



7.To start a VM during startup
============================


Add entry to "/etc/rc.local" as follows and restart the system

# vi /etc/rc.local

..
su - (username) -c "VBoxHeadless --startvm (OS-Name) &"su - adminad -c "VBoxHeadless --startvm UB12-x64-L300 &"

#
8.Increase a VirtualBox HDD (VDI) size
=====================================

Increase a hdd size to 40GB

# vboxmanage modifyhd /VM/Win7-Test.vdi --resize 40000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
#

9.Convert VMware VMDK to VirtualBox VDI
=======================================

To convert VMDK to VDI with VboxManage:

 
$ VBoxManage clonehd --format VDI input.vmdk output.vdi