[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Xen-users] cloning guests between Dom0's ?
- To: "Simon Hobson" <linux@xxxxxxxxxxxxxxxx>, <xen-users@xxxxxxxxxxxxxxxxxxx>
- From: "Ferreira, N.L." <N.L.Ferreira@xxxxx>
- Date: Tue, 24 Mar 2009 00:27:41 +0100
- Cc:
- Delivery-date: Mon, 23 Mar 2009 16:28:29 -0700
- List-id: Xen user discussion <xen-users.lists.xensource.com>
- Thread-index: Acmr6aSjokxxKHarSoCmYN4J8gs04QAJDzFx
- Thread-topic: [Xen-users] cloning guests between Dom0's ?
Hey Simon
Uau! "Some" information for me to digest, *but* I understood the cons of my protocol.
I was using that protocol to make snapshots of the domU's from the respective dom0, but sooner or later I was going to clone between dom0's.
Nevertheless, the subject of this thread is "cloning guests between Dom0's", thus completely agree with your insights.
Cheers,
N.
-----Original Message-----
From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx on behalf of Simon Hobson
Sent: Mon 23-Mar-09 7:58 PM
To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] cloning guests between Dom0's ?
Ferreira, N. L. (Nuno) wrote:
>I wrote those steps mainly based on :
>
>http://www.howtoforge.com/linux_lvm
>http://www.howtoforge.com/linux_lvm_snapshots
>
>From my experience (short), I was able to clone VM's (SL 47) this
>way (and backup of course). No problems in particular.
>Instead of using tar, dd could also be used (but larger files).
As Fajar wrote, it'll work provided you have a robust enough
filesystem. The links you provide are fine when the machine making
the snapshot is the same as the machine writing files to the volume -
because when you read a block off disk, the OS will automatically
give you any 'dirty' block from cache if there is one.
Ie, one process writes a chunk of data and it goes into cache as
dirty blocks - but has NOT yet been written to disk. Another process
goes to read that data, the OS will see that the data is cached, and
serve up the cached blocks. So you get a consistent view of the
filesystem.
When the machine running LVM and making the snapshot (Dom0) is NOT
the same as the one running the filesystem (DomU), then the snapshot
will be whatever has actually been committed to disk by the DomU
rather than the cached version of what will be on the disk when the
cache gets written. This can give you a really messed up view of
what's on the disk.
In theory, a good journaling filesystem should be able to roll
back/roll forward updates to give a consistent view at some point,
but personally I would prefer not to have to do this. As Fajar points
out, your view of the volume from Dom0 will be very much like the
result of pulling the power plug on a server.
You can minimise the problem by running "sync" on the guest and
creating the snapshot as soon as sync completes - that way, you
minimise the amount of unwritten data in the guest's cache.
>Is there a better way to do this? I'm just a newbie on this strange
>world, trying to do my best ;-)
My personal preference is to do one of the following :
1)
Shutdown the guest cleanly, mount it's filesystem(s) in Dom0, copy
the files contained (rsync is my favourite tool for this). It gives
by far the cleanest copy as everything will have been closed, no
files open, etc - and nothing should change while the copy is in
progress.
2)
If shutting down the guest isn't practical, then bring up the machine
that you are going to clone into, and use a tool like rsync to copy
(across the network) the guest you want to clone - running it from
the guest being cloned. You'll want to exclude non-fs stuff like /dev
and /proc, and you'll probably want to exclude client-specific stuff
(eg /etc/network/interfaces on a Debian system).
Note that you'll still have issues with things like database files -
you're clone may well have 'unclean' files which (depending on
activity and database) may be repairable or unusable. Much like
cloning a guest - when you clone a database, best to either shut down
the database during the copy, or use the database tools to
export/copy it.
For convenience, once I'd got a basic minimal client image, I then
kept this as a template so I can clone it using method 1 to get a
running client quickly, and then use method 2 to make it a clone of
something else.
At the end of the day, there isn't a "right" way - everyone has their
own method that they use - and often it comes down to what tools you
are familiar/comfortable with.
--
Simon Hobson
Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.
_______________________________________________
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
|