LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   Clone/duplicate a Xen VM / domU? (https://www.linuxquestions.org/questions/suse-opensuse-60/clone-duplicate-a-xen-vm-domu-618921/)

jantman 02-05-2008 03:45 PM

Clone/duplicate a Xen VM / domU?
 
Hi,

I've googled around endlessly, and can't find anything - even in the Xen or OpenSuSE docs.

I'm running OpenSuSE 10.3 and Xen3.

Is there any way to clone or duplicate a virtual machine? And what would need to be done in terms of reconfiguration?

I'm looking to test a bunch of network monitoring applications, and compare them to each other. So I figured, given that I have a spare box with Xen on it, the easy way would be to install OpenSuSE 10.3 as a new Xen VM - a default installation for the "base" machine - and then make a copy of that for each package that I want to comparatively test. That would allow me to have a relatively level playing field for all of them (run one at a time with no other system load), as well as pause and restart them as needed. Most importantly, when I pick one of the four I'm looking at, I could just trash the other VMs and use the one I want.

Thanks,
Jason

Pyrrhic 02-08-2008 02:45 PM

Dear Jason:

I know it is a long time since you posted but this is still mysterious to many people. Xen no longer allows the simple copying of a disk image or other location of a guest domain (domU), followed by editing an existing config file or creating a new one in the - now legacy - standard location of:

/etc/xen/guestconfigfoo.sxp

As of 3.0.4 Xen configuration files are of the name config.sxp and are dynamically managed. Thus, hand-editing a config of this type is contra-indicated as it will be written over.

New tools to manage Xen Guest domains include:

virt-viewer
virt-install
virt-image

...and, yes, "virt-clone."

These tools are evolving and it is best to get the latest versions at:

http://virt-manager.et.redhat.com/index.html

virt-clone the tool that you are interested in is installed with 'virt-install' - I strongly suspect that your system already has these tools installed. virt-clone can run interactively or you can feed it command line parameters - and they are pretty simple. It deals with sticky little details like unique MAC address, UUID etc. Nice...

There should also be a man page on your system...well I hope...and you can find it on the internet as well it will be something similar too:

virtinst/man/en/virt-clone.1


Currently, I am having a problem with virt-clone, alas, but when it is working right it is a great boon, especially with the changes in the way configs are managed in Xen.

I hope that this helps a little, Jason or at least someone else!

Best,

Pyrrhic

jantman 02-08-2008 03:39 PM

Thanks for the info!

I'm running Xen 3.1.0 under OpenSuSE 10.3, but the only virt-* tool that I see installed is virt-manager. I'll look into finding a RPM.

Pyrrhic 02-09-2008 12:39 PM

More on Xen Cloning - post 3.0.4
 
Dear Jason:

If your system created its domU (..or domU's_) with virt-install, you will find the config.sxp at:

/var/lib/xend/domains/ ...your DomU's UUID #/config.sxp

...this is the new default location for .sxp (ie Xen config) files. IF you open the file you will note that it is no longer in Python format. Again, not a file to edit directly.

I continue to have trouble with virt-clone and if you find that you have trouble, as well, on your system, just write, I am under great pressure to update my Xen cloning knowledge and will know more, I hope, in the next several days. It looks as if I should post a 'how to' on cloning DomU's post-3.0.4, as soon as I have answers to my virt-clone bug problem!

Best,

P.

P.S. - don't know about an rpm but what about YaST, if you are using SuSE?

Pyrrhic 04-08-2008 02:16 PM

Dear Jason:

Sorry for the long wait for a further post - events (...and illness...) overtook me. virt-clone is now working properly, slip-stream fixes have been done. If your version does not work, get a new one, as per previous post. Now it is working I am able to clone a 10gig domU in a matter of a few minutes and the new guest is, immediately, ready to go!

Best,

Pyrrhic

Boris.Grinac 06-23-2008 02:05 PM

Cloning XEN VM on OpenSUSE
 
Yes, Jason, documents are not available, but cloning a XEN VM is easy, trivial.

To clone a XEM VM:
1. Look into /var/lib/xen/images and find the directory where your original OS is installed. It is a good idea to have images directory on a separate partition, so that you can do the usual wonders with it, like mount, umount ...
2. Create a directory under images with the name of your clone VM.
3. Copy the template VM disk image or images is your original system have more virtual disk drives to the clone directory.
3. Now use the Create Virtual Machines tool and edit the default options for memory, processors and disks. Your new machine should have the same number of virtual processors as the original. Memory is not critical, so you can enter any good number. When you come to disks, you will see there is one disk already there, this is the one you copied.
4. Press Finish and your clone will start up. The problem with your clone is, specially with Windows, that it has the same machine name as the original, so change the computer name and maybe domain and reboot.
5. Enjoy


Quote:

Originally Posted by jantman (Post 3047168)
Hi,

I've googled around endlessly, and can't find anything - even in the Xen or OpenSuSE docs.

I'm running OpenSuSE 10.3 and Xen3.

Is there any way to clone or duplicate a virtual machine? And what would need to be done in terms of reconfiguration?

I'm looking to test a bunch of network monitoring applications, and compare them to each other. So I figured, given that I have a spare box with Xen on it, the easy way would be to install OpenSuSE 10.3 as a new Xen VM - a default installation for the "base" machine - and then make a copy of that for each package that I want to comparatively test. That would allow me to have a relatively level playing field for all of them (run one at a time with no other system load), as well as pause and restart them as needed. Most importantly, when I pick one of the four I'm looking at, I could just trash the other VMs and use the one I want.

Thanks,
Jason


ericzqma 01-13-2010 03:07 AM

I manage the VMs in our small cluster. I usually duplicate the DomU VMs by copying the virtual disk and change the config files. And I usually create and start DomUs by "xm create". I know this is the old method. But it runs very well in our platform (kernel 2.6.29, xen 3.4.1). I find the method in this post is different. So I post my method here: http://fclose.com/b/linux/605/how-to...tual-machines/. Hope it is helpful.


All times are GMT -5. The time now is 04:40 AM.