Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
01-03-2011, 04:07 AM
|
#1
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Rep:
|
converting KVM virtual machines to VMware images
I am using KVM on Ubuntu Server 10.04. and Virtual Machines are running on it in LVM.
I have to migrate some of them to Vmware server.How can I achieve this.
I searched and came across some links but they all talked converting vmdk images to qcow or so.
In this case I have OS in LVM.
http://blog.bodhizazen.net/linux/con...irtualbox-vdi/
http://communities.vmware.com/thread/224712
but any of the above did not helped me.
Can some one suggest as where do I begin?
Last edited by tkmsr; 01-03-2011 at 05:44 AM.
|
|
|
01-03-2011, 08:33 AM
|
#2
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
Very rudimentary, but working :
Launch you virtual machine, booting with the g4l (ghost for linux) iso.
Backup an image you save on network (plenty of tutos around).
Create a vmware machine (care of disk size, must be equal or higher than qemu), boot g4l on it and restore the image.
Be aware that if your image is windowze, you probably have to boot with install disk and repair the installation (in the "install on this partition" menu) after restoring it in vmware.
|
|
|
01-05-2011, 02:06 AM
|
#3
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
Quote:
Originally Posted by Linux.tar.gz
Very rudimentary, but working :
Launch you virtual machine, booting with the g4l (ghost for linux) iso.
|
Not possible I do not have access to rack to connect monitor or some switch to get the display on to a monitor.
Quote:
Originally Posted by Linux.tar.gz
Backup an image you save on network (plenty of tutos around).
|
I have rsync backup of the LVMs.
Quote:
Originally Posted by Linux.tar.gz
Create a vmware machine (care of disk size, must be equal or higher than qemu), boot g4l on it and restore the image.
|
Ok I get your point.
Quote:
Originally Posted by Linux.tar.gz
Be aware that if your image is windowze, you probably have to boot with install disk and repair the installation (in the "install on this partition" menu) after restoring it in vmware.
|
Some one suggested to use the snapshot volume to do all this and as they suggested
Quote:
lvcreate -L592M -s -n myvolume /dev/myvg/myvolume_snapshot
qemu-img convert /dev/myvg/myvolume_snapshot -O vmdk myvolume.vmdk
|
I am having hard time here setting up the NFS my USB stick has got some problems so I am not able to do so currently.
|
|
|
01-05-2011, 03:16 AM
|
#4
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
Indeed, you can work with raw data.
Heh, setting up NFS is not THAT hard... ;^)
Post your results, as it is an interesting and useful thread.
|
|
|
01-05-2011, 03:19 AM
|
#5
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
I know NFS is a damn easy thing to do.
My problem about NFS I opened in another thread as I did not wanted to mix this thread with the other problem.
If you want to look that thread then http://www.linuxquestions.org/questi...volume-854301/
only when my NFS problem gets solved I will be able to proceed on this thread.
|
|
|
01-06-2011, 08:54 AM
|
#6
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
Ok since the NFS thing got resolved by your help.
Now updating my attempt to migrate KVM guests to Vmware server.
I found here
http://linhost.info/2009/04/vmware-c...-ubuntu-linux/
How ever in spite of the fact that converter for Linux is free I did not found it useful.
I tested it on two machines first I tried to install the converter on Ubuntu server(where the VMs are actually running) 10.04 64 bit (it badly failed).
God knows how people have succeeded in using it.
Second attempt was to install on a Ubuntu Desktop 10.04 64 bit.The installation went peacefully but the converter
failed to detect the Virtual Machine running on remote host (there is an option to give SSH credentials to vmware-client-converter).
So the converter even failed to work.
I will try to convert the LVM based VM in a qcow image and then convert that to vmdk will post the results as what happened.
Last edited by tkmsr; 01-06-2011 at 08:56 AM.
|
|
|
01-06-2011, 09:43 AM
|
#7
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
I'm just asking myself if qemu-img can convert directly to vmdk...
|
|
|
01-06-2011, 09:54 AM
|
#8
|
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,466
|
Hi
I never tried this, but maybe this converter will not mind that it's a virtual machine?
http://www.vmware.com/products/converter/
|
|
|
01-06-2011, 10:12 AM
|
#9
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
Guttorm in my post above the converter which I mentioned has failed is the same thing which you pointed out.
@Linux.tar.gz
qemu-img directly to vmdk (yes correct) I am away from that system I will try and post the results (it might take next week but I surely will update here )
Last edited by tkmsr; 01-06-2011 at 12:05 PM.
|
|
|
01-07-2011, 12:02 AM
|
#10
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
I am a bit confused with qemu-img.
I was reading man page of qemu-img and what I understand is I need to first create a qcow image file which I need to populate and then convert that to a vmdk file.
Is that understanding correct.
What the situation is it is a production environment where I am having Guest OS running.These OS are in an LVM based setup.
Here is output of lvscan
Quote:
ACTIVE '/dev/abcd/lvm1' [100.00 GiB] inherit
ACTIVE '/dev/abcd/lvm2' [150.00 GiB] inherit
ACTIVE '/dev/abcd/lvm3' [50.00 GiB] inherit
ACTIVE '/dev/abcd/lvm4' [100.00 GiB] inherit
|
Now suppose /dev/abcd/lvm4 is what I would like this to be in its original format running on the server where it is.Can pause or shutdown for some time to take backup.
How ever I want one more image of the which I would like to run on a vmware setup.
So I have two servers one where is originally hosted and will keep running for production use where as another place
where vmware is running there would be different experiments on this vmdk file.
Show is the following way
Quote:
qemu-img convert -c -f raw -O vmdk /dev/abcd/lvm4 /backup/lvm4.img
|
the correct way to go or it will affect the lvm4 on which I apply it and mess with original lvm4.
how
Last edited by tkmsr; 01-07-2011 at 12:03 AM.
|
|
|
01-07-2011, 07:17 AM
|
#11
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
So you better have to use :
find / -depth | cpio -pduv /newfolder
Adapt it to your needs, ie. :
find /where/is/mounted/dev/abcd/lvm4/ -depth | cpio -pduv /newfolder
I will create a cpio archive you can "unzip" on a hard drive, virtual or not.
But i still recommend my first suggestion too. You don't need a cd drive, as you boot the qemu with an .iso.
I have no idea if your qemu-img command will work as you wish, but it won't mess your original lvm, as it only reads it.
|
|
|
01-07-2011, 07:53 AM
|
#12
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
Quote:
Originally Posted by Linux.tar.gz
So you better have to use :
find / -depth | cpio -pduv /newfolder
Adapt it to your needs, ie. :
find /where/is/mounted/dev/abcd/lvm4/ -depth | cpio -pduv /newfolder
I will create a cpio archive you can "unzip" on a hard drive, virtual or not.
But i still recommend my first suggestion too. You don't need a cd drive, as you boot the qemu with an .iso.
I have no idea if your qemu-img command will work as you wish, but it won't mess your original lvm, as it only reads it.
|
Ok I do have the first suggestion you gave me in mind.How ever currently due to hardware constraints it is not possible to do the same.I have no access to a monitor to be able to boot and see the results.Hence I have to do every thing with ssh connection.
Right now this is what I just tried before I read your message
Code:
lvcreate -L5G -s -n myvolume /dev/myvg/myvolume_snapshot
qemu-img convert /dev/myvg/myvolume_snapshot -O vmdk myvolume.vmdk
It is a big LVM volume.So it is taking some time I have no idea as when it will complete but let me see what is the outcome of this work.I hope this should work.
Last edited by tkmsr; 01-07-2011 at 08:27 AM.
|
|
|
01-07-2011, 09:25 AM
|
#13
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
You don't need a monitor when you have ssh ^^.
You can tunnel the X output of applications.
More easy, you can also start qemu with a vnc exported display.
|
|
|
01-07-2011, 09:43 AM
|
#14
|
Member
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798
Original Poster
Rep:
|
Quote:
Originally Posted by Linux.tar.gz
You don't need a monitor when you have ssh ^^.
You can tunnel the X output of applications.
More easy, you can also start qemu with a vnc exported display.
|
Ok
in your above post
Quote:
Originally Posted by Linux.tar.gz
Very rudimentary, but working :
Launch you virtual machine, booting with the g4l (ghost for linux) iso.
|
I am not clear doing this part on ssh.
Quote:
Originally Posted by Linux.tar.gz
Backup an image you save on network (plenty of tutos around).
Create a vmware machine (care of disk size, must be equal or higher than qemu), boot g4l on it and restore the image.
|
The lvm size where the production machine is running is 100G so do I need to have a 100G size in the vmware machine which you say me to create.
Quote:
Originally Posted by Linux.tar.gz
Be aware that if your image is windowze, you probably have to boot with install disk and repair the installation (in the "install on this partition" menu) after restoring it in vmware.
|
I am not clear on this part.
Results of my expermient
Code:
lvcreate -L5G -s -n myvolume /dev/myvg/myvolume_snapshot
qemu-img convert /dev/myvg/myvolume_snapshot -O vmdk myvolume.vmdk
Here I waited for 2 hours and I see a vmdk file which is 12 GB but still the second command is not complete and I see the file
further growing in size beyond 12GB.I have to go out of office so can not continue this command for a moment.So if you can tell what exactly is happening why even after a 12 GB of vmdk things did not stopped.
Also I have one more question I already have the rsync backups of the LVMs in some folders on a USB hard disk.The size of these folders is not more than 5GB or 6GB.Is it not possible to convert these to a format which I can use in vmware or some thing like that?
Last edited by tkmsr; 01-07-2011 at 09:49 AM.
|
|
|
01-07-2011, 11:38 AM
|
#15
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
Launching qemu -vnc display[,option[,option[,...]]] will create a vnc output, so it's pretty easy to connect to it.
You also have to use -boot d -cdrom g4l.iso
I indeed highly recommend to have the same size, ie 100G.
The virtual chipsets of qemu are not necessary the same as the vmware. So, like on real hard drive, if you move a XP from a motherboard to another, you will probably get a BSOD. So you have to repair XP with the cd.
"lvcreate -L5G -s -n myvolume /dev/myvg/myvolume_snapshot
qemu-img convert /dev/myvg/myvolume_snapshot -O vmdk myvolume.vmdk"
Why are you creating an empty lvm, and converting it to .vmdk ?
You can create vmdk directly with qemu-img or vmware.
I have no idea why it oversized the 5G...
I doubt rsync preserves all files attributes. That's why i use cpio instead of a simple tar.
|
|
|
All times are GMT -5. The time now is 01:19 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|