User Tools

Site Tools


maintenance:general:hyperv

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.

  1. Make modifications after migration
  2. 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.

  1. make sure you are root
  2. create a file /etc/dracut.conf.d/hyperv.conf
    1. with the contents: add_drivers+=“hv_vmbus hv_storvsc hv_netvsc hv_utils hv_balloon hyperv-keyboard hyperv_fb hid-hyperv”
  3. type: dracut -f

Option 2: After the migration

  1. Reboot into “rescue” mode
  2. make sure you are root
  3. create a file /etc/dracut.conf.d/hyperv.conf
    1. with the contents: add_drivers+=“hv_vmbus hv_storvsc hv_netvsc hv_utils hv_balloon hyperv-keyboard hyperv_fb hid-hyperv”
  4. type: dracut -f /boot/initramfs-3.10.0-1160.11.1.el7.x86_64.img –kver 3.10.0-1160.11.1.el7
    1. make sure you've typed the correct filename and version
  5. 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.

maintenance/general/hyperv.txt · Last modified: 2024/07/03 12:31 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki