Skip to contentSkip to conversation

snapshots and filesystem freezing

linux-lvm Tomasz Chmielewski 2 participants 2 messages Feb 8, 2008

lore
Share & tools
lore
#0 lore raw

Some filesystems, like xfs, have a "freeze" feature. There was a discussion on lkml about implementing it in ext3, too.

What is the relationship between a filesystem freeze and LVM snapshots?

As far as I understand, snapshotting a filesystem in any random timepoint can mean that the snapshotted fs will be inconsistent (i.e., may need fsck).
"Freezing" the filesystem will flush all writes to the media, and a snapshotted fs should be consistent then (in theory; without an interface between filesystem freeze and LVM snapshot it does not guarantee that the operation is "atomic").

Am I correct?

Signature · 2 lines
Tomasz Chmielewski
http://blog.wpkg.org
#1 lore raw
Quoted 5 lines · Tomasz Chmielewski

Some filesystems, like xfs, have a "freeze" feature. There was a discussion on lkml about implementing it in ext3, too.

What is the relationship between a filesystem freeze and LVM snapshots?

Quoted 7 lines

As far as I understand, snapshotting a filesystem in any random timepoint can mean that the snapshotted fs will be inconsistent (i.e., may need fsck).
"Freezing" the filesystem will flush all writes to the media, and a snapshotted fs should be consistent then (in theory; without an interface between filesystem freeze and LVM snapshot it does not guarantee that the operation is "atomic").

Historically, executing sync() does most of what freeze does, though there's a risk that some pesky process will go and do
a write (or some in-flight write will land) after the sync and before you finish the snapshot.
XFS decided to be different; I think they wanted to shout out to the world that the old sync() idea was racy, so they refused to implement it properly, and introduced the theoretically safer freeze/thaw idea. They may yet drag the rest of us kicking and screaming into the modern world.

Comments in
http://www.paragon-cs.com/wordpress/?p=67 mention that
one used to have to do the xfs freeze manually, but lvm2 now does it for you. (It also mentions that you really want to manually quiesce your apps, too.)
- Dan