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.

XenServer 5.6 SP2
ESXi 5.1

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.

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 (
    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 :)