Home > Networking, Software > Migrating a VM from XenServer to Hyper-V

Migrating a VM from XenServer to Hyper-V

My last two posts have spoken about my former XenServer and the fact that I replaced XenServer with Hyper-V. What I didn’t explain was how to actually migrate the exiting virtual machines off XenServer and into Hyper-V.

If you are lucky enough to have both XenServer and Hyper-V servers running concurrently, the process goes a lot quicker than the way I had to do the task. In my case I had to migrate VM’s off the server, install and configure Server 2012 R2, install Hyper-V and then set up my VM’s. Not a difficult task, just time consuming. With two servers, you can move the exported VM hard drive directly to Hyper-V and get going a lot quicker. Moving 120+GB VHD files does take some time, even on gigabit Ethernet.

On XenServer, I had 5 VM’s. I determined that I would be migrating 3 of them, while I would rebuild the other 2 from scratch once Hyper-V was up and running. I searched the net for info on how to do a migration of the existing VM’s, but there wasn’t a lot of info out there. I certainly couldn’t find any tools to do the job automatically, which is a pity as there is plenty of tools that will convert from Hyper-V to VMware and vice versa, or do a Physical to Virtual (P2V) migration.

I did come across info that said that once I had exported the VM, the VM would be able to boot in Hyper-V without problems. I tried exporting a VM directly from XenCenter, but it wouldn’t export VHD files. Exporting an OVF file and then converting that was possible, but it would be even more time consuming while waiting for the conversion.

Eventually the solution I found was to use Microsoft’s Disk2vhd program. It’s a small program that will snapshot the VM inside XenServer and push it to a VHD or VHDX file, which is the hard drive format used by Hyper-V. The program will create one file per physical drive, not per partition. So a VM with a hard drive with 3 partitions on it will actually create only 1 file.


Store the VHD file anywhere except on the machine being captured. Depending on the size of the drives, the process could take a few minutes to a few hours. Having a gigabit network helps in this regard, as the program will max out your network connection if you save the file via the network.

If you are capturing a server running Exchange or SQL or acting as a TMG firewall, stop all those services before capturing so that you don’t have any inconsistencies after the machine is booted up again.

Once you have your VHD file, this can be copied onto your Hyper-V server’s local storage or cluster storage or whatever you are using. Set up your VM in Hyper-V using Generation 1 hardware (unless you captured Windows 8/Sever 2012) and boot up the VHD file. Hyper-V will boot the system up and once you reach the desktop, Windows will install some drivers. Before you reboot, go to Programs and Features and remove all the XenServer tools and drivers. Reboot the VM, then install the Hyper-V tools, reboot etc.

By the time you are done, the VM should be running stably inside Hyper-V. You will need to reactivate your copy of Windows due to the massive hardware changes, as well as set up any static IP addresses again, as the virtual network card from XenServer is obviously not carried over to Hyper-V. Watch out for your anti-virus product (if you had one installed previously.) After I migrated my Exchange Server over, the VM started locking up and rebooting. Turns out that the specific version of NOD32 that was on the server was conflicting with the Hyper-V tools.

Speaking of my Exchange server, that particular system has gone from being on Pentium 4 class server into XenServer, through 3-4 XenServer OS upgrades and now into Hyper-V. Pretty amazing when you think about how it’s managed to survive all these jumps. Even more surprising when you consider it’s running on Server 2008 (not R2) which is basically the Vista code base.

I hope this helps someone out there who is contemplating making the move themselves, or is simply doing research. Always helps to have someone experiment before you and take those nervous steps first.

  1. Grant Louis
    May 18, 2016 at 22:13

    Hi. I have a Xenserver with 2 VM’s (MS Server 2008 R2 OS) I’ve used MS Disk2VHD utility to export my VM’s… All went as described… My problem is importing into Hyper-V as you described here in your blog… If you look at my Thread with MS Partner, Title: Importing a Xenserver VM to Hyper-V… You’ll see my problem… If you could take a min to look at the last couple of post between MS and myself, maybe you could point me in the right direction.
    Thanks – Grant

    • astraltraveller
      June 5, 2016 at 11:29

      Hi Grant. Sorry for the late reply, I only saw this comment now. Hopefully you managed to find an answer in the meantime. I found your thread and what the last 2 posters said was correct: AVHDX files are snapshots only created by Hyper-V. The only way I know of for these to be created is for you to have done a snapshot somehow on the VM at some point. I don’t have any experience with snapshots, as I’ve never used them.

      Your steps in your post differed from mine in that you exported an OVF file from XenCenter, which I didn’t do – I used Disk2VHD inside the running VM to make VHDX files directly, so I also avoided having to do a conversion afterwards. From there it was simply a matter of attaching those to a new VM in Hyper-V and replacing tools etc.

      If you can, try using the tool to make fresh VHDX files from the VM’s in Xen, if you still have that server running. I have no idea how you ended up with the AVHDX file, so maybe a fresh export will help.

      All the best and good luck,

      • Grant Louis
        June 5, 2016 at 14:05

        Hi Craig
        Thanks for your reply..
        I’ve got my exported Xen VM’s imported into my server 2012 R2 test bed… finally.. I contacted my Xenserver Tech Support guy to help as I was at my wits end.. He also supports Server 2012….

        I had two problems with my attempted imports… (I did use the Disk2VHD app for the export and that worked great) the first problem was the test bed has SCIC Drives, so when I accepted the default SCIC drives in Hyper-V… Wrong.. It needed to be IDE. The other problem was the boot order… Hyper-V’s boot order was CD, IDE…. I just assumed it would by pass the CD and boot from the second item, IDE.. Wrong again.. So, Moving the IDE to first in the boot order and selecting IDE in the drives Worked…
        No idea how the snapshot was taken btw.. fat thumbs maybe..
        Hope this might help others as I did a lot of watching YouTube videos and reading and didn’t find good instructions on how and why some items would or would not be selected in the Hyper-V import of VHDX files.
        Thanks again

  2. March 9, 2017 at 18:25

    Reblogged this on Cloud & Virtualization and commented:

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: