VMware Communities
xurizaemon
Contributor
Contributor

VM conversion from Xen and qEmu

I'm an existing Xen user (fairly happy with Xen too) who is evaluating VMWare because it would offer virtualisation across both OSX and Linux.

I have my Xen images available as single-file linux disk images (for portability), and would like to know how I can import these to VMWare for testing.

It would be really nice to be able to use the same virtualisation system on both Linux and OSX. My experience with Xen has been very positive, but the extra portability would be great.

Is there a guide similar to the Parallels-to-VMWare guide for what I'm hoping to do?

0 Kudos
6 Replies
aetm
Hot Shot
Hot Shot

If those files with Xen are compatible with qEmu, you could convert them with qEmu.

To convert a raw Qemu image (for example, disk.img) to VMware disk format (disk.vmdk), use:

qemu-img convert disk.img -O vmdk disk.vmdk

First back up the file you'll convert, just in case....

this might be useful http://cri.ch/linux/docs/sk0020.html even if it's not for Fusion itself, Fusion uses the same vmdk format.

Message was edited by:

aetm

0 Kudos
xurizaemon
Contributor
Contributor

I tried both Linux qemu-img and the qemu-img included in Q.app. Q.app doesn't seem to grok the -O option, because I ended up with duplicate of my original img, named "-O". The Linux version generates an OK-seeming VMDK - cool!.

But it doesn't boot ("no bootable device found"). I worked out what the issue is, though Smiley Happy

My disk images are a single \*partition*. If I boot off a Linux CD, I can mount the disk with mount /dev/hda /mnt (not /dev/hda1). So I have two options:

1/ Tell VMWare that this VMDK is a partition, not a disk. I'm sure this is ide0:0.deviceType = "???" ... but my searches for deviceType don't tell me much to help here. Any ideas?

2/ Make a new empty image, fdisk it into partitions, dd the contents of my .ext3 file into the first partition, and bump it back through qemu-img to regenerate the VMDK. Ugh!

0 Kudos
victory
Contributor
Contributor

For some reason, the OSX version of

qemu-img

has a problem with the order of cmd-line args.

Try this instead:

qemu-img convert -f raw -O vmdk infile.raw outfile.vmdk



BTW, bonus tip: As noted,

qemu-img

can incorrectly create a file called

'-O'

. This can be a problematic file to delete because the hyphen is often interpreted as a cmd-line switch. (e.g.

rm -f "-O"

won't work). Instead, delete it using:

rm -f "./-O"

0 Kudos
rcardona2k
Immortal
Immortal

For file-backed virtual storage, the x86 machine VMware emulates expects an entire disk (MBR + table + partition), so you can't direct it at a logical partition. I mean that's the job of a boot loader. For raw disks, i.e. using dd to copy your partition to a host logical partition, you could create a VMware rawdisk file that is backed by that partition but this requires modifying the partition table of a physical drive.

I think your suggestion of constructing, e.g. formatting a virtual disk and restoring the filesystem as the primary logical partition should work. This is what Ghost and Acronis do all day.

xurizaemon
Contributor
Contributor

Answering my own question now, I guess Smiley Happy

I found a workaround which functions fine for me and am now running copies of my Xen VMs in VMWare on OSX. Stoked.

I generate a base system in VMWare from the OS install disks (whatever version my Xen VM is). Then kick off an rsync of the files from the Xen to the VMWare image and have a cuppa tea.

I exclude the following directories: /boot (not doing anything kernel-specific), /proc, /dev. There are a few tweaks to make to the VM once this is done - networking needs reconfiguration, hostname, nothing complex.

BAM! One VMWare copy of a working Xen server. Delight.

0 Kudos
ELMASRY1122
Contributor
Contributor

Hello did you document the process??

facing the same issue

thank you

0 Kudos