[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] How can I duplicate a running guest OS in Xen ?



On Sat, 2007-04-28 at 09:58 +0800, openbsd shen wrote:
> When a guest OS is running in Xen, how can I duplicate it?
> Thanks.
> 
> Sailer

There is no "elegant" way to do this if the guest is running. The best
way I've found is to follow these steps :

1.) On dom-0 create a vbd of equal size (or the size you want for your
clone). This can be a loop, lv , whatever.

2.) xm block-attach it to the running dom-U

3.) Enter the dom-u, most likely you will have to use mknod to create
the device for the new drive in /dev (probably going to be sdc1 if its a
pv guest) in which case you'd type 'mknod /dev/sdc1 b 8 33' 

4.) Format it (this can also be done on dom-0) and mount it.

5.) Use rsync or a similar utility to make a copy of the root file
system. Get only the stuff you need.

6.) Once copy is done, unmount the second fs, 'sync' and exit the dom-u

7.) Go to dom-0 xm block-detach the cloned drive. create your config for
the new VM, make a swap vbd for it, get it all set up. Mount the file
system in dom-0 and make your edits in etc/ to change networking (ip and
stuff)

8.) Unmount and boot the new clone :)

Like another poster has said, if your current dom-u is under heavy
stress (lots of SQL activity or so) this isn't the best idea even using
the above method which doesn't need to worry about locking. You still
should watch inodes like you would in any other regular GNU/Linux
system.

If you are running database servers, you should dump -> import them from
old to new after booting the clone so that they're identical. Lots of
stuff could have changed after rsync left /var/lib.

Hope this helps, 
--Tim

> 
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.