How to convert a vmware linux virtual machine to xenserver virtual machine

As the title of this documents says, this document describes how to convert a vmware virtual machine to xenserver virtual machine. Although so far this procedure hasn't fail, please use this procedure on your own risk.

1. Install quemu on the vmware Server or another Linux machine (on debian based distribution use apt-get install qemu-utils, on centos use yum install qemu)

2. Uninstall vmware modules on the vmware guest you wish to convert

3. Stop the vmware guest

4. Check the format of the vmdk file:

qemu-img info guest22-flat.vmdk
image: fooguest22-flat.vmdk
file format: raw
virtual size: 15G
disk size: 15G

5. If the file format is "raw", we need not convert the image file using qemu-img convert, just rename to .img file. If it is not "raw", use "qemu-img" to convert the image to raw format.

6. Convert the file with qemu-img

qemu-img convert guest22-flat.vmdk -O raw /volumes/guest22/guest22.img

7. Copy the image file to the xen server with scp or rsync

rsync -avz --stats --progress --partial /volumes/guest22/guest22.img root@xenserver:~/

8. Create a guest with at least the same disk size and amount of RAM as the imported vmware virtual disk. Rename the disk under properties so you can locate it later (your_disk_name).
9. Open a console or connect to the xen server with ssh and find the disk copy the uuid of the host

xe vdi-list name-label=your_disk_name

uuid ( RO)                : 565c8fcf-5a52-4f05-8fd0-de943b99fa12
          name-label ( RW): your_disk_name
    name-description ( RW): your_disk_name description
             sr-uuid ( RO): 81c5bb77-8fe5-628e-f407-73b07b7054cd
        virtual-size ( RO): 8589934592
            sharable ( RO): false
           read-only ( RO): false

10. Import the image (use the uuid from the step 9)

xe vdi-import uuid=565c8fcf-5a52-4f05-8fd0-de943b99fa12 filename=guest22.img

11. Fire up your converted xen image. You may have to modify the grub boot loader vmware uses /dev/sda for it’s HD and xen uses /dev/hda.

12. If you machine does not boot press e at the grub prompt an search for root=/dev/sda1 line and change it to root=/dev/hda1 please change this in you grub.conf once the machine has booted and save your changes

Note: if your vmware guest has multiple 2G vmdk files you need to merge all of them into one single file. Please consult the page:

2 thoughts on “How to convert a vmware linux virtual machine to xenserver virtual machine”

Leave a Reply

Your email address will not be published. Required fields are marked *