How to Convert a Xen Guest to VirtualBox
This How To guide describes the steps involved in migrating a Xen based virtual machine to the xVM VirtualBox environment.
Preparation
This tutorial assumes that the Xen virtual machine uses a raw disk image (typically created using the dd command) and that VirtualBox is installed and running on the target host system. For details on installing VirtualBox refer to the following chapters of the VirtualBox 2 Essentials online book:
Converting the Xen Disk Image to VirtualBox VDI Format
The first step in converting a Xen based virtual machine to VirtualBox involves converting any virtual disk image files associated with the Xen guest to the VirtualBox Virtual Disk Image (VDI) format. This is achieved using the VBoxManage command line tool which is bundled with the VirtualBox installation. The location of this tool will depend on the host operating system on which VirtualBox is installed. On Windows hosts, the default path is:
- C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe
On Linux and Solaris hosts, the default path to the VBoxManage tool is as follows:
- /opt/VirtualBox-<version>/VBoxManage
where <version> represents the version of VirtualBox installed on the system.
The syntax for performing a conversion using VBoxManage is as follows:
- VBoxManage convertfromraw [-static] -format <format> <source image file> <target image file>
For example, the following command converts a raw image file named xenvista.img to a VDI virtual disk:
VBoxManage convertfromraw -format VDI xenvista.img VBoxVista.vdi VirtualBox Command Line Management Interface Version 2.1.4 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. Converting from raw image file="xenvista.img" to file="VBoxVista.vdi"... Creating dynamic image with size 10485760000 bytes (10000MB)...
Creating the VirtualBox Virtual Machine
Once the disk has been converted, the next step is to create a VirtualBox virtual machine to accommodate converted virtual disk image. To complete this phase of the migration, refer to Creating and Managing VirtualBox Virtual Machines, following the instructions to use an existing virtual disk image.