Table of Contents
Hyper-V hypervisor
This document describes what is required to migrate from a virtual machine on VirtualBox to Hyper-V.
Centos 7
In order to migrate Centos 7, there are a couple of possibilities.
- Make modifications after migration
- Make modifications before migration
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.
Option 1: Before the migration
Make the following modifications to the OS, before creating the VHD.
- make sure you are root
- create a file /etc/dracut.conf.d/hyperv.conf
- with the contents:
add_drivers+=“hv_vmbus hv_storvsc hv_netvsc hv_utils hv_balloon hyperv-keyboard hyperv_fb hid-hyperv”
- type:
dracut -f
Option 2: After the migration
- Reboot into “rescue” mode
- make sure you are root
- create a file /etc/dracut.conf.d/hyperv.conf
- with the contents:
add_drivers+=“hv_vmbus hv_storvsc hv_netvsc hv_utils hv_balloon hyperv-keyboard hyperv_fb hid-hyperv”
- type:
dracut -f /boot/initramfs-3.10.0-1160.11.1.el7.x86_64.img –kver 3.10.0-1160.11.1.el7
- make sure you've typed the correct filename and version
- reboot to the desired kernel
Create the VM with the existing VHD
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.