This document describes what is required to migrate from a virtual machine on VirtualBox to Hyper-V.
In order to migrate Centos 7, there are a couple of possibilities.
In both situations you'll need the Virtual HardDisk (VHD), which can be copied from the GUI or using the CLI. If you have the OVA, you may extract it using tar and clone the disk to the VHD format:
tar xvf VM_name.ova VBoxManage clonemedium disk VM_name-disk001.vmdk VM_name-disk001.vhd --format vhd
The second command can be used directly on the source as well.
Make the following modifications to the OS, before creating the VHD.
add_drivers+=“hv_vmbus hv_storvsc hv_netvsc hv_utils hv_balloon hyperv-keyboard hyperv_fb hid-hyperv”
dracut -f
add_drivers+=“hv_vmbus hv_storvsc hv_netvsc hv_utils hv_balloon hyperv-keyboard hyperv_fb hid-hyperv”
dracut -f /boot/initramfs-3.10.0-1160.11.1.el7.x86_64.img –kver 3.10.0-1160.11.1.el7
You have the VHD copied to your Hyper-V machine and are now in the process of setting up the Virtual Machine. Make sure you select a “type-1” Virtual Machine and at the step of the Harddisk select, choose the existing option and select the VHD.
Once done, make sure you have “checkpoints” disabled.
Once you boot, you will see the system hanging. This is due to the fact the previously created kernel with initramfs doesn't have the necessary drivers for Hyper-V.
To “Fix” this, we will modify the initramfs to include the necessary drivers. See option 2: After the migration.