Fedora Linux Support Community & Resources Center
  #1  
Old 11th June 2009, 11:41 PM
bjrosen Offline
Registered User
 
Join Date: Jul 2005
Posts: 155
Migrate VMware to KVM

Is there any means of converting a VMware VM into a KVM VM? If there is no direct way is there a KVM tool that will convert a running system into a KVM VM like VMware has? If that exists it would be possible to run it on a VMware VM to produce a KVM VM?
Reply With Quote
  #2  
Old 12th June 2009, 12:45 AM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
for vmware 3 & 4 you can use qemu-img, eg

yum install qemu-img
qemu-img convert vmware.vmdk -O qcow2 qemu.img
Reply With Quote
  #3  
Old 12th June 2009, 05:12 AM
bjrosen Offline
Registered User
 
Join Date: Jul 2005
Posts: 155
How do I load the image into KVM? I tried doing a restore machine but it gives me an image magic error.
Reply With Quote
  #4  
Old 12th June 2009, 09:09 PM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
Create a new VM, , then add the image as "managed other existing storage" instead of creating a new image (in fact I notice you can add an existing vmdk image so no need to run qemu-img manually)
Reply With Quote
  #5  
Old 13th June 2009, 12:51 AM
bjrosen Offline
Registered User
 
Join Date: Jul 2005
Posts: 155
I've tried it with a Win2K VM and an XP VM. The WIn2K VM tries goes into a boot loop and eventually crashes. I tried removing VMware tools but that made it worse. The XP VM gets no where. It says booting from hard drive and then just sits there.

Are there KVM drivers that I could install while running the VMs under VMware?
Reply With Quote
  #6  
Old 13th June 2009, 01:49 AM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
I think you need to rerun the Windows setup CD and select Repair option.

There's a howto on the kvm site, but it's a bit muddled:

http://www.linux-kvm.org/page/How_To..._Vmware_To_KVM

I'm not sure what you meant by "kvm drivers", kvm provides the virtualisation layer via /dev/kvm, the hardware devices emulation is done via qemu, windows should support the devices natively.
Reply With Quote
  #7  
Old 13th June 2009, 02:19 AM
bjrosen Offline
Registered User
 
Join Date: Jul 2005
Posts: 155
I mean the equivalent of VMware tools.
Reply With Quote
  #8  
Old 8th July 2009, 12:04 PM
kmiller Offline
Registered User
 
Join Date: Jan 2009
Location: Brisbane, Australia
Posts: 5
Has anyone managed to get this to work yet?

I have F11, and have fresh installed vm's working just fine, but can't get the qemu-img version 0.10.5 to work.

I've tried these syntax's;

qemu-img convert -O qcow2 Win2K.vmdk Win2K.qcow2
qemu-img convert Win2K.vmdk Win2K.qcow2
qemu-img convert Win2K.vmdk -O qcow2 Win2K.qcow2

I get the error qemu-img: Could not open 'Win2K.qcow2' all the time.

I created an image just in case;
# qemu-img create -f qcow2 Win2K.qcow2 4G
Formatting 'Win2K.qcow2', fmt=qcow2, size=4194304 kB

Still no success, am I doing something wrong?

Thanks

Keith
Reply With Quote
  #9  
Old 8th July 2009, 01:22 PM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,420
It should have worked. But it gave me a hard time to so I just booted vmplayer and virtual machine manager with a live cd. From there I used dd to duplicated the drive on a network share and then wrote it back into virtual machine manager. Seamed like I was going to the moon and back but I'm not beating on it today so it's something to consider.
Reply With Quote
  #10  
Old 8th July 2009, 01:23 PM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
Do you have enough free space in the directory?
Reply With Quote
  #11  
Old 8th July 2009, 01:44 PM
kmiller Offline
Registered User
 
Join Date: Jan 2009
Location: Brisbane, Australia
Posts: 5
Thanks Beaker, wow! That is a journey all right! If I can't get it to work by the weekend, then that's what I'll do.

Good question Sideways! This system does have more than ample disk, but I've also been running the command as root, changing file permissions and ownership. Moved the file from one disk to another, really running out of options.

Looks like I may need to file a bug at this rate.
Reply With Quote
  #12  
Old 8th July 2009, 02:05 PM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
ensure the vmdk file is recognised correctly (not as 'raw' format for example)

Code:
qemu-img info Win2K.vmdk
if so, try specifying formats and full path explicitly

Code:
qemu-img convert -f vmdk Win2K.vmdk -O qcow2 /home/user/Win2K.qcow2
(You're not using fat32 I hope, check free space and filesystems with 'df -hT')
Reply With Quote
  #13  
Old 9th July 2009, 01:19 AM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,420
You might be fighting selinux so check the file context. Default img location is /var/lib/virtlib/images.

I tried again on a clean install and it went without a hitch so I might revisit that box soon. I'm hoping it was one of those thing which refuse to work till the next day.

Late edit: If you have multiple files (-1.vmdk, -2.vmdk) then try converting into a single file firt. i.e., MyMachine.vmdk. I just converted dimdim's without a hitch.

Last edited by beaker_; 9th July 2009 at 01:26 AM.
Reply With Quote
  #14  
Old 9th July 2009, 03:57 AM
kmiller Offline
Registered User
 
Join Date: Jan 2009
Location: Brisbane, Australia
Posts: 5
Hi Sideways,

Yes, the file is being seen as raw, is that my problem? Google fails me on this

Code:
# qemu-img info /home/<user>/vmware/Win2K/Win2K-000001.vmdk
image: /home/<user>/vmware/Win2K/Win2K-000001.vmdk
file format: raw
virtual size: 0 (0 bytes)
disk size: 4.0K
I've tried;
Code:
qemu-img convert -f vmdk /home/<user>/vmware/Win2K/Win2K-000001.vmdk -O qcow2 /home/<user>/Win2K.qcow2
qemu-img: Could not open '/home/<user>/vmware/Win2K/Win2K-000001.vmdk'
The host system is F11 with ext4 and the image "should" be NTFS.

Hi beaker, I have so many scars and wounds from SElinux its always disabled on my systems

You said
Quote:
If you have multiple files (-1.vmdk, -2.vmdk) then try converting into a single file firt. i.e., MyMachine.vmdk.
How did you do that? The file list from the directory is;
Code:
vmware-0.log
vmware-1.log
vmware-2.log
vmware.log
Win2K-000001-s001.vmdk
Win2K-000001-s002.vmdk
Win2K-000001-s003.vmdk
Win2K-000001-s004.vmdk
Win2K-000001-s005.vmdk
Win2K-000001.vmdk
Win2K.nvram
Win2K-s001.vmdk
Win2K-s002.vmdk
Win2K-s003.vmdk
Win2K-s004.vmdk
Win2K-s005.vmdk
Win2K-Snapshot1.vmem
Win2K-Snapshot1.vmsn
Win2K.vmdk
Win2K.vmsd
Win2K.vmx
Win2K.vmxf
Am I missing a step here?

I looked at the vmware.log, and it says the vmware was version=6.5.0. These vmware images have been migrated from every release of Fedora since FC6! and I would really like to avoid vmware and move to kvm, but my window of opportunity is running out.

Thank you beaker and sideways for all your help, I really appreciate it guys!
Reply With Quote
  #15  
Old 9th July 2009, 12:42 PM
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,102
In the man page for qemu-img it says:

Quote:
"vmdk"
VMware 3 and 4 compatible image format.
so looks like Vmware version 6.5 images can't be converted.

Looks like you'll have to do something like beaker suggested, boot up the vmware image (in VMware), connect to some other external shared drive, and use dd to write the whole disk image in raw format. Then rerun' qemu-img convert' on the raw image.
Reply With Quote
Reply

Tags
kvm, migrate, vmware

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow LVM Migrate? Tekno_Cowboy Using Fedora 5 24th February 2009 07:21 AM
How did you migrate? niko123456 Wibble 41 17th May 2007 07:36 AM
migrate from rh8->fc4? hsaptus Installation, Upgrades and Live Media 3 23rd March 2006 10:04 AM


Current GMT-time: 05:21 (Wednesday, 26-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
United States Instagram Photos - Cruces - Voerde Travel Photos on Instagram