Cool Solution - Migrating a native Windows installation to UVMM

From Univention Wiki

Jump to: navigation, search
Produktlogo UCS Version 4.1
Logo UVMM

Note: Cool Solutions are articles documenting additional functionality based on Univention products. Not all of the shown steps in the article are covered by Univention Support. For questions about your support coverage contact your contact person at Univention before you want to implement one of the shown steps.

Also regard the legal notes at Terms of Service.

This article describes how to migrate a Windows installation into a UVMM instance. It was tested and confirmed with Windows 7 and Windows 10 and should also work with other versions.
Please note, that we always recommend a clean installation of Windows inside UVMM instead of migrating, if possible.

Migration

Prerequirements

For this migration, you will need the following items:

  • A working Windows installation you wish to migrate
  • A working UVMM server as destination
  • A Linux Live CD (For example SystemRescueCd)
  • (Optional) A hard drive, which can hold all hard drives you whish to migrate or
  • (Optional) A network connection between your source and destination computers

Preparation

Before starting the migration, you should remove your old hardware drivers on your Windows installation to prevent any problems afterwards. For this you will need the Windows Device Console (Devcon.exe) from Microsoft. Microsoft unfortunately only offers this tool included in the Windows Driver Kit (WDK) or as source files anymore, which means, that you will have to download and install it.

Folders for various architectures can be found below C:\Program Files (x86)\Windows Kits\10\Tools\ after installing the Windows Driver Kit. A fitting devcon.exe can be found in these. Be careful to use the right path to use the correct devcon.exe for your architecture later on. You can now uninstall your drivers after locating the tool.
For this, you will have to open a command prompt as Administrator, move into the folder C:\Windows\INF and execute the tool with the following arguments:

cd  C:\Windows\INF
<PATH TO TOOL>\devcon.exe install "mshdc.inf" PCI\CC_0101

Now, you can reboot your system to your Linux Live CD.

Copying the whole harddrive

To transfer a native Windows installation into a UVMM instance, the harddrive has to be saved as an image file, which is then used by UVMM.

Hint: If the native installation used more than one harddrive the following procedure must be repeated for every harddrive!

You can identify your installed harddrives with the following command after booting with your Live CD:

fdisk -l

It is recommended to use an external harddrive or a USB flash drive to transfer the system:

dd if=/dev/sda of=/mnt/usb/windows.raw

Depending on the size of the device sda this will take some time.

You can also transfer the harddrive by combining the dd command with a scp command. This omits the need of external storage, but might be more time consuming due to possible CPU and network limits. Consult the following article, if you need help: Transfer image compressed via SSH


When the process is finished for all drives you want to copy, the system can be shut down.

The image is saved as raw file and can now be used as a virtual harddrive with UVMM. For this, the raw image is copied to /var/lib/libvirt/images on the UVMM host.

If KVM is used for virtualization and advanced features should be used, then the image must be converted to a qcow2 file:

cd /var/lib/libvirt/images/
qemu-img convert -f raw -O qcow2 ucs.raw ucs.qcow2

Afterwards, a new virtual instance must be created, using the profile which describes the installation best, e.g. Microsoft Windows 10 (64 Bit). The raw or qcow2 file must be assigned as harddrive. After starting the virtual instance, the system boots up.
Note: this might take a few seconds, as Windows will need to detect all hardware components and install their drivers. Don't shut down your system while Windows hasn't finished booting up. Also note, that there is a known bug for Windows 10 systems. Please take a look at the Known Issues area, if your system doesn't boot and you just see a Windows logo without rotating circle.


We recommend, that you now delete all obsolete drivers. For this, you need command prompt running as Administrator again and execute the following commands:

cd  C:\Windows\INF
<PATH TO TOOL>\devcon.exe findall * > hwlist.txt
for /F "tokens=1,2 delims=:" %i in (hwlist.txt) do @for /F "tokens=1,2 delims= " %a in ("%i") do <PATH TO TOOL>\devcon.exe remove "@%a"
<PATH TO TOOL>\devcon.exe rescan
del hwlist.txt

You are now finished with the basic migration and can reboot. You can optionally install drivers for paravirtualization, if you want to improve the performance of your instance.
For this, follow the steps below.

Known issues

Windows 7 64bit not booting

It's currently not possible to boot a Windows 7 64bit instance after the migration. The following error code prevents Windows 7 from booting:

0x0000007B

Further information - https://support.microsoft.com/de-de/kb/2673509

Windows 10 not booting

There is currently a known bug, which prevents Windows 10 from booting as a virtual machine inside UVMM.
Bug #39827
This can be worked around by editing the xml-File of that virtual machine and creating a cpu entry, which statically sets the cpu type to core2duo as described here.
The xml-File can be opened with the following command on the KVM-Server:

virsh edit <machine name>

Drivers for Paravirtualization

By default, migrated Windows systems are configured for full virtualization. To improve performance of your instance, you can install KVM-Hypervisor drivers for paravirtualization on your Windows system.

More information on this can be found in our Documentation

Personal tools