Difference between revisions of "Cool Solution - Migrating a native Windows installation to UVMM"

From Univention Wiki

Jump to: navigation, search
m (Removed links to deleted pages.)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Produktlogo UVMM}}  
+
{{Version|UCS=4.1}}
{{Version|UCS=2.4}}
+
{{Produktlogo UVMM}}
 +
{{Cool Solutions Disclaimer}}
 +
{{#seo:
 +
|title={{#replace:{{#replace:{{#replace:{{#replace:{{FULLPAGENAME}}|'|'}}|&|&}}|"|"}}|Cool Solution - |}} - {{SITENAME}}
 +
<!--|description=-->
 +
}}
  
Das hier beschriebene Vorgehen führt bei der Migration von nativen Windows XP- und Windows Server 2003-Instanzen zum Erfolg. Für die Migration anderer Windows-Versionen wurde das Verfahren nicht getestet.
+
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.<br>
                                                                         
+
Please note, that we always recommend a clean installation of Windows inside UVMM instead of migrating, if possible.
Vor der Migration in die virtuelle Umgebung empfiehlt es sich, alle Hardwaretreiber aus der Windowsinstallation zu entfernen. Die von Microsoft bereitgestellte Datei [http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272 devcon.exe] greift per Commandline auf den Gerätemanager zu und kann für das Zurücksetzen der Hardwarekonfiguration benutzt werden.
 
         
 
<tt>devcon.exe</tt> muss nach <tt>c:\1</tt> entpackt und dann im Ordner <tt>C:\WINDOWS\INF</tt> aufgerufen werden:
 
  
Start -> Ausführen -> "cmd"
+
{{TOC}}
cd  C:\WINDOWS\INF
 
C:\1\i386\devcon.exe install "mshdc.inf" PCI\CC_0101
 
  
Anschließend wird das System von einer Linux-Live-CD (etwa [http://www.sysresccd.org/Download SystemRescueCd]) gebootet.
+
== 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 [http://www.sysresccd.org/Download 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
  
Die vorhandenen Festplatten kann man sich mit dem folgenden Befehl anzeigen lassen:
+
=== 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 [https://msdn.microsoft.com/en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 '''Windows Device Console (Devcon.exe)'''] from Microsoft.
 +
Microsoft unfortunately only offers this tool included in the [https://developer.microsoft.com/en-us/windows/hardware/windows-driver-kit Windows Driver Kit (WDK)] or as source files anymore, which means, that you will have to download and install it.
  
  fdisk -l
+
Folders for various architectures can be found below <tt>C:\Program Files (x86)\Windows Kits\10\Tools\</tt> after installing the Windows Driver Kit. A fitting <tt>devcon.exe</tt> can be found in these. Be careful to use the right path to use the correct <tt>devcon.exe</tt> for your architecture later on.
 +
You can now uninstall your drivers after locating the tool.<br>
 +
For this, you will have to open a command prompt as Administrator, move into the folder <tt>C:\Windows\INF</tt> and execute the tool with the following arguments:
 +
<pre>
 +
cd C:\Windows\INF
 +
<PATH TO TOOL>\devcon.exe install "mshdc.inf" PCI\CC_0101
 +
</pre>
  
Zum Übertragen des Systems empfiehlt sich das Auslesen der Festplatten und die Zwischenspeicherung auf einer externen Festplatte, etwa mittels
+
Now, you can reboot your system to your Linux Live CD.
  
dd if=/dev/sda of=/mnt/usb/win.raw
+
=== 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.
  
Alternativ kann das [[Image komprimiert über SSH übertragen]] werden.
+
''Hint'': If the native installation used more than one harddrive the following procedure must be repeated for every harddrive!
  
Ist dieser Vorgang abgeschlossen, kann der Rechner ausgeschaltet werden.
+
You can identify your installed harddrives with the following command after booting with your Live CD:
 +
<pre>
 +
fdisk -l
 +
</pre>
  
Das Raw-Image wird dann auf den UVMM-Host nach /var/lib/libvirt/images/ kopiert.
+
It is recommended to use an external harddrive or a USB flash drive to transfer the system:
 +
<pre>
 +
dd if=/dev/sda of=/mnt/usb/windows.raw
 +
</pre>
  
Kommt KVM als Virtualisierungstechnologie zum Einsatz und sollen die erweiterten Funktionen des Image-Formates qcow2 genutzt werden, kann das Image konvertiert werden:
+
Depending on the size of the device ''sda'' this will take some time.
  
cd /var/lib/libvirt/images/
+
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.
qemu-img convert -f raw -O qcow2 win.raw win.qcow2
+
Consult the following article, if you need help: [[Transfer image compressed via SSH]]
  
Anschließend wird in UVMM unter Verwendung des entsprechenden Windows-Profils eine neue virtuelle Instanz angelegt, der das raw- oder das qcow2-Image als Festplatte zugewiesen wird. Nach dem Start bootet Windows. Da alle Hardwarekomponenten neu erkannt werden müssen, braucht der Startvorgang einige Zeit. Wenn der Wiedereinrichtungsvorgang abgeschlossen ist, fordert Windows zum Neustart auf und ist anschließend einsatzbereit.
 
  
=Treiber für Paravirtualisierung installieren=
+
When the process is finished for all drives you want to copy, the system can be shut down.
  
Migrierte Microsoft Windows-Systeme sind in der Grundeinstellung in Vollvirtualisierung installiert. Zur Verbesserung der Performance können zur direkten Anbindung an den XEN- bzw. KVM-Hypervisor Treiber für die Paravirtualisierung installiert werden.  
+
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 <tt>/var/lib/libvirt/images</tt> on the UVMM host.
  
==GPLPV für Xen==
+
If KVM is used for virtualization and advanced features should be used, then the image must be converted to a '''qcow2''' file:
 +
<pre>
 +
cd /var/lib/libvirt/images/
 +
qemu-img convert -f raw -O qcow2 ucs.raw ucs.qcow2
 +
</pre>
  
Die von James Harper entwickelten Windowstreiber für Xen-Paravirtualisierung stellt Univention signiert bereit. Für Download und Installation gibt es eine [[Installing-signed-GPLPV-drivers|Dokumentation]] in diesem Wiki.
+
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.<br>
 +
'''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.
  
==Virtio für KVM==
 
  
Die Treiber müssen unter http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/ heruntergeladen werden. Diese Anleitung bezieht sich auf die Einrichtung mit einem virtuellen Diskettenlaufwerk über eine VFD-Datei und bezieht sich auf Version 1.1.16. Die heruntergeladene VFD-Datei muss im Speicherbereich abgelegt werden, z.B. unter /var/lib/libvirt/images/ und als Diskettenimage eingebunden werden.
+
We recommend, that you now delete all obsolete drivers. For this, you need command prompt running as Administrator again and execute the following commands:
 +
<pre>
 +
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
 +
</pre>
  
Vor dem Start kann für das Netzwerkinterface direkt Paravirtualisierung ausgewählt werden. Windows installiert die Treiber dann beim Neustart vom eingebundenen Diskettenimage.  
+
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.<br>
 +
For this, follow the steps below.
  
Für die Installation der Festplattentreiber ist ein weiterer Schritt notwendig. Zuerst wird ein temporäres Festplattenimage erzeugt, eingebunden und anschließend als "Paravirtualisiertes Laufwerk" markiert. Da Windows von einem paravirtualisierten Laufwerk nicht booten kann, wenn es die entsprechenden Treiber nicht kennt, wird der Treiber durch die temporäre Festplatte im System bekannt gemacht.  
+
== 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:
 +
<pre>
 +
0x0000007B
 +
</pre>
 +
Further information - https://support.microsoft.com/de-de/kb/2673509
  
Ein Neustart installiert automatisch die Treiber, die dann für die entsprechende Windowsversion ausgewählt werden können. Anschließend wird Windows heruntergefahren und nun auch für das übertragene Festplattenimage Paravirtualisierung ausgewählt. Beim nächsten Start von Windows kann dann die Treiberinstallation durchgeführt werden. Die temporäre Festplatte kann anschließend ebenso wie das Diskettenimage entfernt werden.
+
=== Windows 10 not booting ===
 +
There is currently a known bug, which prevents Windows 10 from booting as a virtual machine inside UVMM.<br>
 +
[https://forge.univention.org/bugzilla/show_bug.cgi?id=39827 Bug #39827]<br>
 +
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 [https://libvirt.org/formatdomain.html#elementsCPU here].<br>
 +
The xml-File can be opened with the following command on the KVM-Server:
 +
<pre>
 +
virsh edit <machine name>
 +
</pre>
 +
 
 +
== 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 [https://docs.software-univention.de/manual-4.1.html#uvmm::gplpvvirtio Documentation]
  
 
[[Category:Virtualisierung]]
 
[[Category:Virtualisierung]]

Latest revision as of 14:02, 8 September 2017

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