VMware Cloud Community
f_dias
Contributor
Contributor

VM Migration from KVM to VMWare

Hello everyone.

So we have an old infrastructure in which I have some machines to import to our actual environment.

Old environment for virtualization was using KVM. The actual environment we are using VMWare ESX 6.5 with VSphere.

The current issue I am facing is regarding one of the machines we need to import that has the following setup:

- 4 vCPU

- 4Gb RAM

- 4 HD

- Centos 6.3

- LVM configured for the whole environment

I am trying to import by following these steps:

- Convert from img / qcow2 to vmdk on the old system

- Create a new VM on VMWare without any hard disk

- Copy these files to the VMWare datastore folder previously created

- Clone theses disks to vmdk format with vmkfstools

- Change ddb.adapterType from IDE to lsilogic

- Boot the VM on VMWare

After this, my expectation was that the system would boot. What does happen is that it freezes before even show the boot menu from GRUB.

I booted with a centos installer cd to the rescue system and the volumes can mount with no issues. From there, I tried to repair / reinstall the initramfs, reinstall grub, fsck to the volumes.

I always end up with the infamous freeze when trying to boot.


What am I forgetting or what should I do differently?

Does anyone have an idea or some advice?

Many thanks in advance.

Tags (4)
Reply
0 Kudos
17 Replies
DavoudTeimouri
Virtuoso
Virtuoso

Convert virtual machine by VMware vCenter Converter.

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
Reply
0 Kudos
NathanosBlightc
Commander
Commander

You can download the vCenter Converter. Check the following link please:

Download Center for VMware Products

Also you can use QEMU to convert KVM vDisks to VMware vDisks (VMDK extension)

Install QEMU based on Linux platform by running following CLI:

RedHat based:

yum install qemu-img

Debian based

apt-get install qemu-kvm

apt-get install qemu-utils

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

I did used qemu-img to convert the virtual machine's disks. Sorry I didn't mentioned on the first post the tools I used. So, I already used qemu-img to convert from qcow2 to vmdk. And then on teu VMware servers, I used vmfktools. All of that, at least visually, ran smoothly and with no problems.

I've tried to use converter, but its wasn't finding the old VM. I don't have an error or more feedback on that now, but can provide later.

After all of that I am in a position where I have the disk files on the new VM, I can see the contents using a rescue mode, rescue mode can mount the LVM volumes automatically, but when I try to boot the VM it freezes even before any GRUB menu os shows.

Reply
0 Kudos
NathanosBlightc
Commander
Commander

If I understand now you have successfully your VMDK and then you add it to the new VM. Now you have problem in VM boot ...

First of all check your VMDK in both of VMware Workstation and VMware ESXi VM types

This time please review your VM configuration about BIOS / UEFI mode and switch between them and check again. If the problem still exist convert the VMDK file by VMware converter. I hope this try solve your problem

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

You do understand correctly. So I have the VM on the VMWare server, but it does not boot.

BIOS is configured as BIOS, it was never EFI.

I have tried VMware vCenter Converter, but I have a different error now. It says host 192.168.XXX.X key, can't be retrieved. I've googled this message and it says something about firewall or IPTABLES on the original machine. I've disabled the firewall, but still have the same message.

It's worth to mention as well, that those structures (KVM & VMware new server) are on different networks. I can only connect to both at the same time while using a VPN to the old network.

Reply
0 Kudos
NathanosBlightc
Commander
Commander

Remove all imported certificate about your destination ESXi host and open it by vSphere client and add successfully cert again! Next try to convert it again.

Also no need to disable firewall, just following ports must be open: TCP 443, 902, 445 and UDP 137, 138

pastedImage_0.png

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

Are those certificates added automatically? Do you mean remove them on OS?

Reply
0 Kudos
NathanosBlightc
Commander
Commander

Self-Signed certificate of ESXi, I mean ... remove from vCenter Converter client system and try to connect to the host again

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

Well, I removed the certificates and ended by reinstalling converter again. When I ran it again, the following is logged:

Task: Convert physical machine.

Powering on the destination virtual machine to run as the Converter helper server.

Connecting the Converter helper ISO image to the destination virtual machine.

Waiting for the destination virtual machine to boot up as the Converter helper server.

Connecting to the Converter helper server on the destination virtual machine.

Connected to the Converter helper server on the destination virtual machine.

Partitioning the destination disks.

Formatting the destination partitions.

And then it stops with the following:

FAILED: A general system error occurred:
Network error. Host 192.168.160.5 key can't be retrieved. (return code 2)

Completed 3%

Reply
0 Kudos
NathanosBlightc
Commander
Commander

Why you choose the source computer as a Physical machine (P2V Operation) that needs to deploy Converter agent on this machine? Why you don't try to start a V2V that consider source VM (for example in a VMware Workstation VM type) and select destination into an ESXi host?

If you want to P2V method you can choose another dedicated network interface for VM converting. Please read the following link's correct answer:

Fail to convert P2V at 3% with error. Host <IP> key can't be retrieved

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

Because there is no option to use KVM infrastructure and that's all I have on the old side, not VMware.

According to the right answer on that link, both should be on the same network, which is not the case for my scenario.

So I am kind of stuck here with converter, I think.

That's also why I went with the crusade to convert the VMs first and deploy them after convertion to the ESXi server or vcenter.

Reply
0 Kudos
NathanosBlightc
Commander
Commander

I think you should review following checklist to avoid confusing:

1. First create a VMDK file by running QEMU CLI from KVM infra

2. Then add this vDisk to the VMware Workstation new installed VM

3. Run the VMware Converter to Convert from VMware Workstation to VMware ESXi (V2V)

4. Start this new generated VM in the ESXi host

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

So, if I see your point correctly, I need to add an extra step by booting VM on VMware workstation before ESX?

Reply
0 Kudos
NathanosBlightc
Commander
Commander

No need to boot exactly, just create a new VM (in workstation) by this new converted VMDK and then convert it again through vCenter Converter

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
f_dias
Contributor
Contributor

I did as suggested, but I got to exactly the same step as before.

Just a frozen prompt even before getting the boot menu from OS.

Steps I followed are:

1 - Convert KVM disks from QEMU to VMDK doing the following command:

qemu-img convert -f qcow2 ORIGINAL_DISK_FILE.img -O vmdk DESTINATION_DISK_FILE.tmp.vmdk -o compat6

2 - Copy the generated files to the new network.

3 - Create a new VM on VMware Workstation and add the disk files copied from before

4 - Use VMware vCenter Converter to convert to vCenter

5 - Boot VM.

The whole process ran smoothly with no issues.

When I got to the vCenter and started the VM, I just got a frozen black screen with a frozen prompt in it.

Before, I was doing extra steps, from the 3rd step onwards. It was like this:

3 - Create a new VM on vCenter

4 - Copy disk files to Datastore VM folder

5 - Clone disks from the old ones to the new format by using the following command:

vmkfstools -i DESTINATION_DISK_FILE.tmp.vmdk -d thin FINAL_DISK.vmdk

6 - Edit the VMDK file to change the ddb.adapterType from ide to lsilogic

7 - Boot VM.

Reply
0 Kudos
f_dias
Contributor
Contributor

This is strange.

After a few hours left with the VM hanging frozen with the damn prompt, it did boot to the OS!!

This didn't happened before, also did left it like this for a few hours.

What could be the reason now? I am aware it may be more with the VM OS than with the vCenter, but nevertheless..

Reply
0 Kudos
calvinzhang82
Contributor
Contributor

hi there. i've encountered exactly same satuation with you. i've converted lot of centos vms from qemu to vmware , using same method. strange is, some works fine ,some didn`t . some vm prompts ata device problem but boot successfuly , some freezed in black screen. even they have same linux kernel. here i want to ask : have you found the solutions to this problem? did the vm that finally booted boot normally next time? thank you !
Reply
0 Kudos