VM Ware 2 Xen

Translated with Google Language Tools from site: http://www.eisxen.org/49.html - Edited by Kwadroke (WIP)

VMWare virtual machines as Xen guests

Converting an existing Linux VMWare machine into an image, which can be used for a Xen guest.

In addition one needs Qemu

Steps to convert

1. install qemu

2. Convert the VMDK file of that VMWare machine, which is to be used for a Xen guest, into an RAW image:

qemu img convert -f vmdk /home/vmware/maschine.vmdk -O raw /home/xen/vmimage.raw

3. We have now have vmimage.raw, this is an image, which we can not mount, since it is in the RAW condition. We must make now thus first the partitions in this image, in order to be able to extract these as individual filesystem images.

fdisk -l -u /home/xen/vmimage.raw

Device Boot    Start       End    Blocks   Id  System
linux1 * 63 208844 104391 83 Linux
linux2 208845 7550549 3670852+ 83 Linux
linux3 7550550 8193149 321300 82 Linux swap

Here the linux2 partition interests us. In order to cut out now, we must determine the number of block according to the formula END START + 1. Applied to the above example: 7550549 - 208845 + 1 = 7341705.

The result from our computation results in the value for the dd parameter COUNT, and the initial value is the value for the dd parameter skip.

cd /home/xen
dd if=vmimage.raw of=vm.img bs=512 skip=208845 count=7341705

4. Loopback mount the image

mount -o loop -t ext3 vm.img /mnt