Bobcares

Migrate Windows VM from HyperV to KVM – How to do it?

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.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF