On Mon, Nov 20, 2006 at 10:15:44PM -0600, Sidney Cammeresi wrote:
> On Mon, 20 Nov 2006 at 13.17.55 -0600, Florin Iucha wrote:
> > On Mon, Nov 20, 2006 at 11:44:49AM -0600, Shawn Fertch wrote:
> > > Isn't snapshot a function of the filesystem type and not LVM?
> > 
> > Snapshot is a function of the block device.  Some filesystems, such as
> > XFS have a built-in freeze/dump capability which can simulate it
> > pretty well.  What LVM snapshot is able to do, is allow you to
> > "freeze" a block device for online back-up while writing pending
> 
> The filesystem has a little to do with it, I think.  My memory is hazy,
> but I vaguely remember once having a problem where I'd make a snapshot
> LV, but when I mounted it, it was inconsistent and needed an fsck.
> 
> Given that the filesystem was contained in a snapshot LV, this process
> did not exactly get too far off the ground....

The freeze/thaw functionality is part of the VFS to enable snapshots.
When you create a snapshot with LVM2, it tells the VFS that it needs to
get the file system in a consistent state.  The VFS in turn calls the
freeze function in the file system to do whatever the file system needs
to do in order to make the snapshot consistent.  That might mean sync
out the log and write an unmount record.  Once the file system is done
LVM2 gets control back and creates the snapshot.  Now you should be able
to mount the file system without it looking corrupt.

Nate