forced fsck (again?)

Andreas Dilger adilger at
Mon Feb 11 18:19:41 UTC 2008

On Jan 31, 2008  16:27 +0000, Matt Bernstein wrote:
> Please forgive my late noticing of this. The idea is good, and will work 
> fine in 99% of cases.
> I'd love to snapshot (for rsync as well as fsck) my large filesystems, 
> which have external journals which in turn are in a different VG.
> I suspect that if I were to naïvely run your script, really interesting 
> things would be likely to happen ;)

Well, the LVM snapshot code interacts with the filesystem and ext3 locks
the whole filesystem and flushes the entire journal before the snapshot
is done.  This means that the journal is "clean" when the snapshot is done
(needs_recovery flag is cleared in the ext3 superblock).

The problem of course is that after the snapshot is done and the filesystem
unfrozen the journal will continue to be used.

> So.. I'd love to atomically make two snapshots, but I guess that is Hard 
> (or would at least require a very coarse lock). I suppose in the meantime I 
> could "tune2fs -O ^has_journal" the snapshot volume, but I'm too scared 
> even to do that.

That would be exactly the right thing to do, because there isn't any data
in the journal at all related to the snapshot.  Making this automatic in
some fashion is more desirable of course.

> So.. maybe I could request that you either include a Big Fat Disclaimer, or 
> code based on the following (untested, you can probably do better)?
> if (tune2fs -l /dev/${VG}/${VOLUME}|egrep -q "Journal device")
> then
> 	echo "Cowardly refusing to play with external journals."
> 	echo "There be dragons!"
> 	exit 1
> fi

Definitely a good idea until someone does a bit of testing with this
and understands the interaction of the snapshot filesystem with the
still-in-use journal device.

Cheers, Andreas
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

More information about the Ext3-users mailing list