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

Re: LVM2 snapshot question



On Sat, 2006-05-13 at 13:00 -0400, Jiann-Ming Su wrote:
> On 5/13/06, Arafangion <thestar@fussycoder.id.au> wrote:
> >
> > What happens if the data changes during your sync? This is why people
> > are looking at using LVM snapshots - during which rsync'ing would be a
> > good idea
> >
> 
> How does the LVM snapshot get around the problem of a changing
> filesystem during the snapshot?

I'm not sure if you're asking about snapshots in general, or just about
files changes during the moment when the snapshot is created. I'm not
sure about the latter, but creating an LVM snapshots takes only a few
seconds so I'd imagine it's not much of an issue.

If you're asking about snapshots in general, however, that's the whole
point of having snapshots. LVM takes a chunk of available space from the
drive and designates it a snapshot diff area. Once the snapshot is
activated, the current filesystem is "frozen" in place. No further
changes are written to the original filesystem. Any future changes are
written directly to the snapshot diff area.

LVM transparently keeps track of both of these areas and returns a
"unified" filesystem to the OS that includes all of the changes that
have been made since the snapshot. However, if you ever decide to go
back to the time of the snapshot, LVM just dumps the diff area and
starts using the original image again. If, later, you decide that you
want to keep all of the changes, LVM merges those changes in with the
original filesystem and you're left with an up-to-date filesystem.

It's kind of like having a CVS for filesystems. It's one of the greatest
strengths of LVM in my opinion. (Second only to pairing it with xfs and
allowing growing the filesystem without unmounting.)

-- 
Alex Malinovich
Support Free Software, delete your Windows partition TODAY!
Encrypted mail preferred. You can get my public key from any of the
pgp.net keyservers. Key ID: A6D24837

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: