WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Xen backups using LVM Snapshots

On October 17, 2008 10:51 am Kevin Fox wrote:
> On Fri, 2008-10-17 at 10:41 -0700, Javier Guerra wrote:
> > On Fri, Oct 17, 2008 at 12:29 PM, Kevin Fox <Kevin.Fox@xxxxxxx> wrote:
> > > If you were running a single OS with lvm snapshots (IE, no xen),
> > > would the snapshots be consistent? IE, no fsck needed ever for the
> > > snapshots?
> >
> > > If so, then there must be a mechanism for LVM snapshotting to tell
> > > the file system to coalesce to disk before the snapshot.
> >
> > No.

Not directly, but some FS, like XFS, have features that make it more 
amenable to LVM-style snapshots.  xfs_freeze can be used to temporarily 
put all I/O on "pause", and flush data to the FS.  Then you can take an 
LVM snapshot and get a consistent snapshot.  After the snapshot is 
created, you unfreeze the filesystem.  If you script it, you get an I/O 
interruption of only a couple of seconds at most.

However, this wouldn't help in the "snapshot LVM from dom0" situation, as 
you couldn't run xfs_freeze directly from the dom0.  But, a little SSH 
and sudo trickery could allow you to do it.

In the domU, configure a backups user, add them to sudoers with the 
ability to run xfs_freeze without a password.  Then, from the dom0, you 
could run something like:

#!/bin/sh
ssh -l backups <domU> "sudo xfs_freeze -f /mountpoint"
lvcreate -s -n domU-snapshot /path/to/domU/lv
ssh -l backups <domU> "sudo xfs_freeze -u /mountpoint"
<do your backups using the domU-snapshot>

> Strange that the file system and LVM have enough knowledge of each
> other to do online resizing, but not snapshotting.

That's the nature of LVM-style snapshots.  The snapshots are done below 
the filesystem layer, where the filesystem has no knowledge of what's 
going on.  As far as the FS is concerned, it's running on a harddrive.

What I really dislike about LVM-style snapshots is that the snapshot is 
outside of the FS, and you have to plan ahead for how much space you 
think you'll need for each snapshot, and you can't keep a bunch of them 
around for very long.

This is one area where in-FS snapshots can work better, depending on how 
they are done.  For example, UFS2 snapshots in FreeBSD can take up to a 
minute to create, and don't scale beyond a handful of snapshots.  But ZFS 
snapshots in FreeBSD (I don't have access to Solaris) are virtually 
instantaneous, and (so far in our testing) scale above 64 simultaneous 
snapshots without any issues.  Plus, you can stream snapshots between 
servers, making remote backups a breeze.

But, that's all kind of beside the point here.

I find doing backups from within the domU (same as is done on physical 
servers) to be the easiest.

-- 
Freddie Cash
fjwcash@xxxxxxxxx

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