[linux-lvm] LVM snapshot?

Tim Post echo at echoreply.us
Sun Dec 21 18:34:27 UTC 2008


On Sun, 2008-12-21 at 09:33 -0500, Tom Diehl wrote:
> Hi,
> 
> I have a machine that is running EL5 with xen. One of the DOMU's has an LV
> from DOM0 mounted on it to allow access to the data. Is it safe to do 
> a snapshot of the LV from DOM0 while it is still mounted rw on the DOMU?

Yes, provided:

1 - You send a sysrq 's' to the guest to sync anything dirty
2 - You pause the guest prior to taking the snapshot

After taking the snapshot, of course unpause the guest. I have a tool
that I wrote using libxenctrl / liblvm2cmd which does this very quickly,
if you'd like it I'll send you the source code when I get back to my
office next week. Its also rather easy to export mount stats (how much
is used on any given mount) via xenbus, which helps automatically size
the snapshots from dom-0.

A fsck -n /dev/xvda(x) within the running guest itself should tell you
(more reliably) if any problems exist, depending on the file system and
journal mode. It need not run completely, ~15 seconds in you'll be able
to tell and just ctrl-c. Moreover, this gives you a general indication
of how big the downtime window should be. Plus, the i/o of the test is
in the dom-u, which is better.

A "All Clean" message will look like the normal "clean" message, plus a
warning that journal recovery is not possible since fsck is not going to
make any changes to the FS.

HTH

Cheers,
--Tim





More information about the linux-lvm mailing list