Migration of VMware image to KVM on LVM (raw)

croeper

New Member
Nov 17, 2009
14
0
1
Aachen
www.berke.biz
Hi there,

I am having trouble migrating a VMware (vmdk) image to KVM residing on an LVM storage.
The story so far: I followed the instructions in the wiki getting a valid qcow2 file. I added a directory to the storage, created a vm in proxmox with a hard-disk utilizing the new dir-storage, detached the hd, copied my qcow2 file over the existing hard-disk image, reattached the hd and started the vm, with success; this all worked like charm.
Next I followed the howto in the wiki to create a LVM group with some extra info from this howto. I tested the LVM group creating a new vm and installing Win2008 on it, worked fine as well.
Finally following the instructions here (in German) I wanted to convert the qcow2 image to a raw image in my LVM. I deleted my 2008_Test vm and created a new vm using LVM group also. Regarding the document the command for converting to lvm is
Code:
qemu-img convert vm-101-disk-1.qcow2 -O raw /dev/vm-sbo/vm-102-disk-1
, but I always get errors saying either "qemu-img: Error while formatting '/dev/vm-sbo/vm-102-disk-1'" or "qemu-img: Error while writing". Also I created a logical volume manually using the instructions in the howto, but I get the same error. What I can run is something like
Code:
qemu-img convert vm-101-disk-1.qcow2 -O raw win2003-pve.raw
resulting in a .raw file. But how do I get this guy into the logical volume in the LVM group?
Does anybody has experience with that, or some idea what is going wrong?
Thanks in advance, best regards

christoph
 
Oh, yes - of course. Thanks, tested and it works.
However there is no direct way to convert the qcow2 image into the LVM group? Meaning that I need the double hard-disk space for each VMware image and one extra conversion (qemu qcow2->raw (double space, extra step), delete qcow2, dd raw->LVM group), right?
 
i made a migration in 2 (two) simple steps, avoiding every windows program like selfimage, and ANY conversion (qcow2, raw, etc)... used NETCAT, this is how:

on proxmox, created a virtual machine of type windows2000 with enough disk space to allocate the "physical" hd space of the source machine, on my drbd space... my new vm has vmid 103, so its disk is /dev/drbdvg/vm-103-disk-1

on the windows machine to migrate, i merged the MERGEIDE.REG file, as for: http://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE#Prepare_the_Windows_operating_system

then, rebooted it with "systemrescuecd" in the cd tray ( http://www.sysresccd.org )
at its prompt, i gave:
Code:
ifconfig eth0 10.0.0.17 netmask 255.255.255.0 up
to bring up networking, then gave root a password with "passwd"... then, i logged in in it from my pc via ssh, and on one of my proxmox servers (10.0.0.27), too...
then, i gave this commands:

on one of the proxmox cluster nodes, gave:
Code:
date; netcat -w30 -vvnlp 3333 | gzip -dc > /dev/drbdvg/vm-103-disk-1; date
then, on the physical machine, and before 30 seconds!!! (that w30...), gave:
Code:
dd if=/dev/sda | gzip -c | nc -w 30 -vvn 10.0.0.27 3333
as sda was my physical harddisk... this way, the proxmox node is waiting for a stream of bytes on tcp port 3333, then gunzip it and redirects on my vm virtual disk, an lvm in my case... the physical machine outputs its ENTIRE hd as a stream of bytes, gzip it and pass it via netcat to the proxmox server....

the 2 date commands are useful to have a trace of when this process starts and ends...

i migrated a 75gb hd in about 90 minutes on a 100mbit lan... machine started and works as expected, at first boot it recognized the new ide controllers, and go on... hope this helps, eventually i'll add to the wiki...
 
i made a migration in 2 (two) simple steps, avoiding every windows program like selfimage, and ANY conversion (qcow2, raw, etc)... used NETCAT, this is how:

on proxmox, created a virtual machine of type windows2000 with enough disk space to allocate the "physical" hd space of the source machine, on my drbd space... my new vm has vmid 103, so its disk is /dev/drbdvg/vm-103-disk-1

on the windows machine to migrate, i merged the MERGEIDE.REG file, as for: http://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE#Prepare_the_Windows_operating_system

then, rebooted it with "systemrescuecd" in the cd tray ( http://www.sysresccd.org )
at its prompt, i gave:
Code:
ifconfig eth0 10.0.0.17 netmask 255.255.255.0 up
to bring up networking, then gave root a password with "passwd"... then, i logged in in it from my pc via ssh, and on one of my proxmox servers (10.0.0.27), too...
then, i gave this commands:

on one of the proxmox cluster nodes, gave:
Code:
date; netcat -w30 -vvnlp 3333 | gzip -dc > /dev/drbdvg/vm-103-disk-1; date
then, on the physical machine, and before 30 seconds!!! (that w30...), gave:
Code:
dd if=/dev/sda | gzip -c | nc -w 30 -vvn 10.0.0.27 3333
as sda was my physical harddisk... this way, the proxmox node is waiting for a stream of bytes on tcp port 3333, then gunzip it and redirects on my vm virtual disk, an lvm in my case... the physical machine outputs its ENTIRE hd as a stream of bytes, gzip it and pass it via netcat to the proxmox server....

the 2 date commands are useful to have a trace of when this process starts and ends...

i migrated a 75gb hd in about 90 minutes on a 100mbit lan... machine started and works as expected, at first boot it recognized the new ide controllers, and go on... hope this helps, eventually i'll add to the wiki...

nice way, can you add this to the wiki? I can do a review.
 
Sorry for my late reply, but I was not only busy testing proxmox scenarios and your howto, but also with my primary task (software development, not administration).

i made a migration in 2 (two) simple steps, avoiding every windows program like selfimage, and ANY conversion (qcow2, raw, etc)... used NETCAT, this is how:
[snip]
I tested that on VMware Server 2.0 virtual machines. The first was a Windows Server 2003 (32-bit), about 16 GB hard-disk size. It took less than 30 minutes on a gigabit lan, and everything was done.
However then I migrated a Windows Server 2008 (32-bit) with about 200 GB hard-disk size. It took about 6 hours on that gigabit lan...
Mon Dec 7 16:47:15 CET 2009
listening on [any] 3456 ...
connect to [192.168.xx.xx] from (UNKNOWN) [192.168.xx.xx] 35321
sent 0, rcvd 142731075
Mon Dec 7 23:55:28 CET 2009

(UNKNOWN) [192.168.xx.xx] 3456 (?) open
419430400+0 records in
419430400+0 records out
214748364800 bytes (215 GB) copied, 25627.5 s, 8.4 MB/s
net timeout
sent 142731075, rcvd 0

This somehow doesn't match your 75 GB in 90 minutes on a 100 MBit lan? I have no real idea, why this is so slow. Maybe because the source machine has no super powers, and gzipping 200 GB eats more CPU and memory than just sending the GBs over the wire uncompressed?
Another thing I do not understand is the "net timeout", although it seemed that the machine is fine and everything seems to be copied (I mean - I guess the machine would not start if a bunch of data is missing).

I had some issues with the machines after boot - all network related -, but at first I was not sure if that might be caused by the different migrate method (it is not, but on virtualized Windows machines you never know):
* Windows Server 2003 froze every now and then, especially with Remote Desktop Connection (RDP)/Terminal Server (TS). I used the Intel e1000 (Pro/1000 MT); after installing the Intel driver (as I found in the wiki), the network is stable.
* Window Server 2008 no need for mergeide.reg anymore
* Window Server 2008 has issues with the Intel e1000 network card, especially with the Intel driver (in contrast to W2K3). The machines froze very often, especially with RDP/TS. It was definitely a network issue, as a parallel running Proxmox VNC connection into the same session showed the GUI changes although the RDP connection was still frozen. I switched to rtl8139 network adapter, and it looks promising for now, no issues so far; but I keep observing this further.

I found some threads (eg. INTEL Modular BLADE Server Support) regarding experience with Intel Modular Server.
So this is all tested on a Intel Modular Server System MFSYS25 with a compute module MFS5520VI. If the Proxmox forum guys think it is worth reposting my findings in a new thread, I can do so.
Best regards

christoph
 
If the Proxmox forum guys think it is worth reposting my findings in a new thread, I can do so.

Its always worth recording your experiences, both for your self and because this is an open source project.

Mike
 
I realize there may be solutions above that work for some people, but I never got around the Boot from Hard Disk freeze after trying everything. Here's what finally got my system up. It's strange (essentially xcopying your windows drive to a freshly formatted drive then making the latter active and running a windows repair with the appropriate ISO) but it finally got me up and running.

Prerequisities

After multiple attempts at converting through more normal methods: dd, netcat, qemu-image convert, etc, Richard found the following set of instructions for converting Windows VMs. I'll put it in plainer English in the Step-by-Step:
http://www.linux-kvm.org/page/How_To_Migrate_From_Vmware_To_KVM

Step by step

The basic idea is to xcopy all the files between the VMWare image (A) and a new empty image (B). We'll mount both images as secondary drives on an existing Windows VM (WinVM) so the files will transfer without issue.
1) Move the VMWare image to the Proxmox server. The best way for Windows boxes seems to be mounting the VMWare drive as a secondary drive to an existing VM Windows image. Then use Self-Image to copy the files to an awaiting netcat tunnel on the proxmox box. Detailed here:
Moving Live Image to Proxmox

2) On the Proxmox server, create a Windows VM or use an existing one (WinVM). Create an extra disk, disk storage B to be the same size as disk A. Add these to the Windows VM.

3) Boot WinVM and make sure the drives are there. Drive A and its data should be readily viewable. Drive B will need to be formatted. Do so. We'll assume the two drives are E: (A) and F: (B)

4) Use the following command to copy all files from A to B:
xcopy /e /c /r /h /k /o /x /y E: F:
5) Once this is done, go into Disk Management and make F: the Active drive.

6) Shut down the WinVM. Delete all the storage drives (they'll remain in the list of available drives). Add drive B back to the VM. Add the appropriate Windows ISO to the CD Rom drive and set the Options to boot from CD first. Start the VM and enter the Windows installation. After the license agreement, choose to repair an installation (do not use the repair console).
7) Once repair is complete, reboot and let the new VM image boot up and finish the repair.
8) It will end up booting into the new VM.
9) Remove VMWare Tools (or at least disable the services).
 
  • Like
Reactions: supotnickiy

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!