On a lvm2 based system I have an ext3 fileystem with an external journal.
I want to use lvm2s snapshot facilities to do online backups and fscks.
So I create a snapshot of my filesystem.
Problem #1 - if I try to fsck the snapshot it proposes that I rerun the
journal, even suggesting that the journal be cleared.
# fsck -v -f /dev/group-a/ums-snap
fsck from util-linux-ng 2.16.2
e2fsck 1.41.12 (17-May-2010)
Superblock needs_recovery flag is clear, but journal has data.
Run journal anyway<y>? no
Clear journal<y>? no
If I do rerun the journal the snapshot is, of course, corrupted. I
imagine that if I clear the journal the filesystem will be damaged.
Problem #2 - if, to avoid problem #1 I remove the journal from the
snapshot with tune2fs:
# tune2fs -O ^has_journal /dev/group-a/ums-snap
tune2fs 1.41.12 (17-May-2010)
Journal removed
It destroys the journal of the mounted volume - when I next mount the
volume it complains that it can't find the journal(*)
(* In fact it says: EXT3-fs: External journal has more than one user
(unsupported) but I'm guessing that it's the message that's wrong).
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-3-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages e2fsprogs depends on:
ii e2fslibs 1.41.12-2 ext2/ext3/ext4 file system librari
ii libblkid1 2.17.2-2 block device id library
ii libc6 2.10.2-9 Embedded GNU C Library: Shared lib
ii libcomerr2 1.41.12-1 common error description library
ii libss2 1.41.12-1 command-line interface parsing lib
ii libuuid1 2.16.2-0 Universally Unique ID library
ii util-linux 2.16.2-0 Miscellaneous system utilities
e2fsprogs recommends no packages.
Versions of packages e2fsprogs suggests:
pn e2fsck-static <none> (no description available)
pn gpart <none> (no description available)
pn parted <none> (no description available)
-- no debconf information
--
To UNSUBSCRIBE, email to debian-bugs-...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Yeah, that's a real problem. Right now e2sprogs doesn't really know
about LVM snapshots in any kind of fundamental way. So it doesn't
know that it's checking a snapshot, and so ignoring the journal is the
right thing to do.
I need a way to determine reliably and portably, whether or not a
volume is a snapshot or not. I'm not sure what's the best way to do
it right now, but I wanted to ack this as an accepted bug.
The short-term fix which I could offer is a command-line option to
force e2fsck to ignore the journal, but that really isn't the best way
to go, since users will often forget to give this option, and the
results would then be unfortunate. I suppose it might be a sufficient
if the e2fsck is being invoked from a shell script, but I would like
to see if I can do better...
Regards,
- Ted
I've checked the following patch into the e2fsprogs source tree, which
will be in 1.41.13.
- Ted
commit 8718359b4057bf2b998f4ac6125e33f20efe60cb
Author: Theodore Ts'o <ty...@mit.edu>
Date: Sat Sep 25 21:14:06 2010 -0400
e2fsck: Open the external journal in exclusive mode
This prevents accidentally replaying and resetting the journal while
it is mounted, due to an accidental attempt to run e2fsck on an LVM
snapshot of a file system with an external journal.
Addresses-Debian-Bug: #587531
Signed-off-by: "Theodore Ts'o" <ty...@mit.edu>
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 64a0fd6..b741eb9 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -368,7 +368,8 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
#ifndef USE_INODE_IO
if (ext_journal)
#endif
- retval = io_ptr->open(journal_name, IO_FLAG_RW,
+ retval = io_ptr->open(journal_name,
+ IO_FLAG_RW | IO_FLAG_EXCLUSIVE,
&ctx->journal_io);
if (retval)
goto errout;