Wondering how to migrate Windows VM from HyperV to KVM? We can help you.
As part of our Server Management Services, we assist our customers with several migration queries.
Today, let us see how our Support Techs perform the same.
Migrate Windows VM from HyperV to KVM
Moving ahead, our Support Techs recommend the following steps for the migration:
1. Initially, we need to prepare Windows for hardware change.
We replace the HDD Controller with Standard IDE (XP and Win7).
Set ‘Start’ value to ‘4’ (XP only) for:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Processor
Or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Intelppm
2. After that, we copy VHD file from windows to linux.
To do so, we share the VHD disk file on the windows server.
Then we go to Linux server and run:
smbget smb://HVServer/shared/Ecology.vhd
3. Now, we need to create volume for master disk:
lvcreate --size 4196M --name /dev/vg_storage/ecology_master
4. We then convert VHD disk to LVM Volume:
qemu-img convert -p -f vpc -O raw Ecology.vhd /dev/vg_storage/ecology_master
5. The next step is to create Master VM:
virt-install \ --name ecology_master \ --ram 512 \ --os-type=windows --os-variant=winxp \ --vcpus 1 \ --disk /dev/vg_storage/ecology_master,device=disk,bus=virtio,format=raw \ --network network=default,model=virtio \ --graphics vnc \ --noautoconsole \ --import \ --noreboot \ --debug
6. Create small temporary img disk:
qemu-img create /mnt/storage/disk.img 1G
In addition, we download virtio drivers:
wget http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-30.iso
7. virsh edit ecology_master
Now we connect the master disk as IDE and connect additional virtio disk to let windows.
By doing so windows will be able to boot without BSOD.
We need to install and load virtio drivers at the same time.
Also, we connect cdrom with virtio drivers.
Replace existing disk tag with:
<disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/vg_storage/ecology_master'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/mnt/storage/disk.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/mnt/storage/iso/virtio-win-0.1-30.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
8. virsh start ecology_master
9. Then to check VNC port we run:
virsh vncdisplay ecology_master
Make a tunnel via putty port 5900 (5900 + N).
After that, we connect with VNC Viewer to localhost:N.
We check Windows started and install drivers from CD-ROM.
Then we shut down the windows.
10. Now when we install the virtio drivers we switch the master disk to virtio and disconnect the second disk from disk.img.
We will keep the CD-ROM for future use.
Now, we proceed to virsh edit ecology_master.
Remove
<disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/mnt/storage/disk.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk>
Replace
<disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/vg_storage/ecology_master'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk>
with Initial disk
<disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/vg_storage/ecology_master'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk>
11. Eventually, we start windows and check if it works.
12. Later, we copy existing template to new:
cd /opt/VCI/etc/templates cp ./oraclient-win7/ ./ecology -R
13. Fix ./ecology/env.sh
If necessary, we change LVM_MASTER and VM_MEMORY
14. Then we fix ./ecology/ip.reg.template
We change Interface GUID. Take from target master VM
([HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces\)
15. Similarly, we fix ./ecology/template.xml
Here, we change tags <name> and <description>
16. Later we execute:
/opt/VCI/etc/reload.sh
17. Finally, we go to VCI web site and test new VM template
[Stuck in between? We are glad to be of assistance]
Conclusion
In short, we saw how our Support Techs migrate Windows VM from HyperV to KVM.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments