Friday, March 1, 2013

Convert XenServer XVA to VMDK for VMWare ESXi 5.1

During our conversion from XenServer to VMWare I had one machine that had a woopsy and would no longer boot in XenServer without BSOD.  Of course, this is the ONE machine I didn't snapshot first HA.

Environment:
XenServer 5.6 SP2
ESXi 5.1


Cause:
During the conversion, I uninstalled the XenServer tools.  When I went to use VMConverter on the machine it couldn't find the disk due to drivers on the SCSI controller.  So, I went to select a generic driver for the controller and low and behold, I selected the wrong one and rebooted.  ACK  Of course I was greeted by the BSOD.


Solution:
I could have just rebuilt the machine, but it was one of those pain machines (ie, reconfiguring it would be more painful then spending an hour seeing if I could fix it).

  1. Export from XenServer to XVA format
    1. I tried to export to OVF, but it would fail and after some quick looking on the citrix forums it looked like it would likely be easier to export to xva then convert to ovf
  2. XenConvert v2.3.1  (version 2.5 doesn't have the options necessary to do this)
    1. From = Xen Virtual Appliance
    2. To OVF
    3. This converts to OVF format which gives you 2 files, an OVF and a VHD
  3. WinImage v8.5 (http://www.winimage.com/download.htm)
    1. Disk dropdown
    2. Convert virtual hard disk image
    3. Select the OVF (vhd file)
    4. OK
    5. Type name and change save as type to vmdk
    6. When you click save the conversion starts
    7. At the end you don't need to mount it with winimage
  4. Create a new virtual machine using the datastore that you want.
    1. Edit the VM and delete the Hard Disk
    2. Browse the datastore and delete the vmdk file
  5. Veeam FastSCP (I used the older version)
    1. Copy the 2 files that WinImage created to the datastore VM Folder
      1. both are vmdk files.  One will be large the other small.  Both are required for this to work (otherwise when you add a hard disk in the next step it won't see it)
  6. Back in VMWare now
    1. Add hard disk
    2. Browse to the VMDK and select it
    3. Boot
    4. Login and install tools
    5. Restart
  7. Change the disk from IDE to SCSI
    1. In VMWare edit the VM and add a new hard disk of 1GB using SCSI (this pulls the controller into the image)
    2. Delete the disk you just created
    3. shutdown the VM
    4. Now we have to edit the vmdk, this can be done using vi, but I'm a windows guy so I used notepad++ on my workstation
      1. pull a copy of the small vmdk down to your local drive using Veeam FastSCP
      2. edit with notepad++
      3. modify the line "ddb.adapterType = "ide" change to "lsilogic"
      4. save and push the file back up to the datastore overwriting
      5. Delete the primary IDE hard disk
      6. Browse the datastore and delete the 1GB vmdk that we created earlier (for getting the LSI controller installed)
      7. Add new hard disk and point to the vmdk
      8. It will find it as SCSI / LSI Logic
      9. Note: if you have a CDROM, it will be IDE 0:1, so you'll want to delete it and re-add it so that it picks up IDE 0:0
      10. Boot
That wasn't so bad...


Your results may vary :)







10 comments:

  1. Thank you for this! I have tried unsuccessfully for over a week to find a way to convert a XenServer disk to VMware. This was awesome!

    ReplyDelete
  2. Hi I'm from Indonesia, I tried your tutorial but still failed, its just only blank in console with one dash (-). i move from xenserver to vmware esxi 6.

    Thanks

    ReplyDelete
    Replies
    1. At what step is it failing? This guide was for XS 5.6 and VMWare 5.1, so may be a version difference

      Delete
    2. At step 6 point 3. when i boot its just only blank so i cannot login. I use Xenserver 6.5 and vsphere 6..

      Delete
    3. Sorry, I haven't tested any conversions to later version of VMWare.

      Delete
    4. Hello,
      I tested your how to with success. For XS 6.5 to vmware 6.0. I skiped the part with Veeam, and all worked fine.
      I passed too much hours on this project, so i have to say thank you hundred of time.
      ps : And sorry for this pitiful english. I'm not native speaker.

      Delete
    5. I have to add what i mean by " i skipped the veeam part". I just transfered the vm using the vsphere client upload option. Hope it'll help.
      But, newbie in this world, can you explain me why we have to switch from IDE to SCSI ? It works anyway right ?

      Delete
    6. Great question. Been a few years since I wrote this so...

      For best performance you want SCSI.

      Also, there might be some cases where it won't boot.
      This gives some good info on the subject as well.
      https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1016192

      Delete