converting virtualbox vm to a xen hypervisor virtual machine _ serverstack

4
2012 Posted by Tweet 1 VirtualBox is one of the easiest virtualization platforms in use today. With graphical user interface, cross-platform support, and comprehensive documentation online, it is also one of the most obvious choices for a developer. So how do you scale this virtual machine from your workstation to a development server? F Au B C C D D E Fu G G G H Li Lo M M N Ng O Pa R Sc Se Se S St U U Vi W Scaling tips, insights, updates, culture, and more from our Server Ex Managed Servers Managed Apps Take a Tour Why ServerStack? Converting VirtualBox VM to a Xen Hypervisor Virtual Machine | ServerStack https://www.serverstack.com/blog/2012/11/20/converting-virtualbox-vm-... 1 of 5 3/19/2015 4:21 PM

Upload: mchallis

Post on 13-Sep-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

  • 2012 Posted by

    Tweet

    1

    VirtualBox is one of the easiest virtualization platforms in use today. Withgraphical user interface, cross-platform support, and comprehensivedocumentation online, it is also one of the most obvious choices for adeveloper. So how do you scale this virtual machine from your workstation to adevelopment server?

    FAuBCCDDjEFuGGGHLiLoMMNNgOPaRScSeSeSStUUViW

    Scaling tips, insights, updates, culture, and more from our Server Ex

    ManagedServers

    ManagedApps

    Take aTour

    WhyServerStack?

    Converting VirtualBox VM to a Xen Hypervisor Virtual Machine | ServerStack https://www.serverstack.com/blog/2012/11/20/converting-virtualbox-vm-...

    1 of 5 3/19/2015 4:21 PM

  • The process is relative straightforward and involves simple steps:

    Step 1: Locate the VDI files location from Virtual Machines setting inVirtualBox. In our example, the VM is CentOS 6.3, disk image name iscentos6.vdi and it uses 654 MB of space. The Virtual Size is the amountof space this disk image will use when converted to RAW format:

    Step 2: Compress the .vdi file of your VM with WinRAR using BestCompression method. This reduced our VDI file from 654 MB to 158 MBRAR archive:

    SNHepr

    C

    ManagedServers

    ManagedApps

    Take aTour

    WhyServerStack?

    Converting VirtualBox VM to a Xen Hypervisor Virtual Machine | ServerStack https://www.serverstack.com/blog/2012/11/20/converting-virtualbox-vm-...

    2 of 5 3/19/2015 4:21 PM

  • Step 3: Upload the archived disk image (centos6.rar) to your Xen servervia SFTP / SCP, and extract centos6.vdi to your Xen image folder (e.g./var/lib/xen/images/ ). You might have to install unrar for your distributionof Linux or download directly from RarLab:

    # wget http://rarlab.com/rar/rarlinux-x64-4.2.0.tar.gz && tar xvfz rarlinux-x64-4.2.0.tar.gz# cp rar/unrar /usr/bin/# cd /var/lib/xen/images && unrar e centos6.rarExtracting centos6.vdi OKAll OK

    Step 4: Download and install VirtualBox on the Xen server. This may seema bit redundant, but we are really just interested in VBoxManage toolsupplied with it. On CentOS hypervisor, install the necessary libraries anddownload VirtualBox 4.2 or whichever is latest:

    # yum -y install qt libXmu && rpm -ivh http://download.virtualbox.org/virtualbox/4.2.4/VirtualBox-4.2-4.2.4_81684_el6-1.

    This should give you VBoxManage utility:

    # ls -l /usr/lib/virtualbox/VBoxManage-rwxr-xr-x 1 root root 758384 Oct 26 12:17 /usr/lib/virtualbox/VBoxManage

    Now you can convert your VDI disk image to a RAW disk image that you will usefor Xen VM:

    # cd /var/lib/xen/images# /usr/lib/virtualbox/VBoxManage clonehd centos6.vdi centos6.img -format RAW

    0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

    Clone hard disk created in format 'RAW'. UUID: f220932f-8750-4f5b-b220-8050210e9835

    Step 5: Refer to the centos6.vbox file, and create the configuration file forXen VM. You can do this manually or create a shell script that would

    ManagedServers

    ManagedApps

    Take aTour

    WhyServerStack?

    Converting VirtualBox VM to a Xen Hypervisor Virtual Machine | ServerStack https://www.serverstack.com/blog/2012/11/20/converting-virtualbox-vm-...

    3 of 5 3/19/2015 4:21 PM

  • uuid = "f220932f-8750-4f5b-b220-8050210e9835"memory = 1024vcpus = 1bootloader = "/usr/bin/pygrub"on_poweroff = "destroy"on_reboot = "restart"on_crash = "restart"disk = [ "file:/var/lib/xen/images/centos6.img,xvda,w" ]vif = [ "mac=00:16:3e:46:e6:fb,bridge=xenbr0" ]extra="console=hvc0"

    Step 6: Create your Xen VM using the configuration file and the RAWimage:

    # cd /etc/xen/# xm create centos6Using config file "./centos6".

    Started domain centos6 (id=16)

    Step 7: Verify that everything is working as expected:

    The virtual machine is up and running on a Xen hypervisor. This simplifies theentire process, as you can develop your entire virtual machine on yourworkstation, and have it up and running on a production hypervisor withouthaving to migrate individual services manually.

    Company

    About ServerStack

    Scalability Blog

    Managed Servers

    Managed Apps

    Contact Us

    (888) 890-6714

    ManagedServers

    ManagedApps

    Take aTour

    WhyServerStack?

    Converting VirtualBox VM to a Xen Hypervisor Virtual Machine | ServerStack https://www.serverstack.com/blog/2012/11/20/converting-virtualbox-vm-...

    4 of 5 3/19/2015 4:21 PM