Hide Forgot
Description of problem: According to the tune2fs man page: -f Force the tune2fs operation to complete even in the face of errors. This option is useful when removing the has_journal filesystem feature from a filesystem which has an external journal (or is corrupted such that it appears to have an external journal), but that external journal is not available. This option does not work as described in the man page, as you can see: [root@kstest ~]# tune2fs -f -O ^has_journal /dev/zoo/home tune2fs 1.41.12 (17-May-2010) The needs_recovery flag is set. Please run e2fsck before clearing the has_journal flag. [root@kstest ~]# The reason I am doing this is that this is a snapshot of an iSCSI device with an external journal. The journal is not available, so I want to remove it so that I can mount the filesystem. Running e2fsck is not possible: [root@kstest ~]# e2fsck /dev/zoo/home e2fsck 1.41.12 (17-May-2010) External journal has bad superblock [root@kstest ~]# Either this is a bug in tune2fs, or a bug in the tune2fs man page. This issue is also discussed here: http://www.redhat.com/archives/ext3-users/2013-June/msg00010.html and here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559301 Version-Release number of selected component (if applicable): [root@kstest ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago) [root@kstest ~]# uname -a Linux kstest.its.yale.edu 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux [root@kstest ~]# rpm -q e2fsprogs e2fsprogs-1.41.12-18.el6.x86_64 [root@kstest ~]# How reproducible: every time Steps to Reproduce: 1. create ext4 filesystem with external journal (say, on a usb stick) 2. unplug the power (leaving the filesystem's needs_recovery flag set) and unplug the usb stick 3. attempt to forcibly remove the ext4 journal as described in the tune2fs man page Actual results: does not work as described in man page Expected results: tune2fs should work as described in man page Additional info: [root@kstest ~]# tune2fs -l /dev/zoo/home tune2fs 1.41.12 (17-May-2010) Filesystem volume name: <none> Last mounted on: /home Filesystem UUID: 433fa4ee-6cbd-4fb0-a5ed-c28bac35591a Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: (none) Filesystem state: clean Errors behavior: Remount read-only Filesystem OS type: Linux Inode count: 100671488 Block count: 402656256 Reserved block count: 0 Free blocks: 44738705 Free inodes: 56033621 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 927 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 RAID stride: 1 RAID stripe width: 16 Flex block group size: 16 Filesystem created: Mon Jul 11 21:29:18 2011 Last mount time: Fri Oct 25 16:02:18 2013 Last write time: Fri Oct 25 16:02:18 2013 Mount count: 9 Maximum mount count: -1 Last checked: Tue Jul 10 09:17:17 2012 Check interval: 0 (<none>) Lifetime writes: 16 TB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal UUID: 046f7c36-e693-4ffb-9923-6a2b8724743c Journal device: 0xfd06 First orphan inode: 34366576 Default directory hash: half_md4 Directory Hash Seed: 08dd6251-808f-43bd-9e64-af461b8d0060 Journal backup: inode blocks [root@kstest ~]#
I have the contents of /var/crash/127.0.0.1-2013-12-10-11:19:48 and /var/crash/127.0.0.1-2013-12-10-14:09:01 if you give me somewhere to upload them. They are around 80 megabytes each (looks like I can't attach anything bigger than 20 megs to this bug).
whoops ignore Comment 1, meant to add that to this bug report (same filesystem, different bug): https://bugzilla.redhat.com/show_bug.cgi?id=1040136
It's not clear that this should behave as you wish. On the one hand, the generic explanation: "Force the tune2fs operation to complete even in the face of errors" does sound that way. But then it goes on to list examples about missing external journals, but doesn't make specific mention of missing but *dirty* journals, which is a bit of a different situation than maybe was originally intended. Still, it seems like it would make sense to allow this - maybe with two "forces" for good measure or something, I'll discuss it upstream. (In the meantime, I think Ted suggested a workaround in that debian bug?)
Yes, I do have a workaround. Thanks for discussing upstream. Even if it is decided that it will not remove dirty journals, the tune2fs man page should be updated to reflect that.
I'll send a patch upstream which will remove it with "-ff" : [root@sandeen e2fsprogs]# misc/tune2fs -f -O ^has_journal fsfile.img tune2fs 1.43-WIP (28-Dec-2013) The needs_recovery flag is set. Please run e2fsck before clearing the has_journal flag. [root@sandeen e2fsprogs]# misc/tune2fs -ff -O ^has_journal fsfile.img tune2fs 1.43-WIP (28-Dec-2013) [root@sandeen e2fsprogs]# dumpe2fs -h fsfile.img | grep -i featu dumpe2fs 1.41.12 (17-May-2010) Filesystem features: ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
commit 5fe2bd60844cfe5d805e62a4316afaa5cd9d7c83 Author: Eric Sandeen <sandeen> Date: Thu Feb 20 20:18:41 2014 -0500 tune2fs: allow removal of dirty journal with two "-f" options Jim pointed out that "tune2fs -f -O ^has_journal" won't remove the journal if the needs_recovery flag is set; the manpage seems to indicate that it should. And if you've lost an external journal and can no longer replay it, how should one proceed? Change tune2fs so that two "-f" options will allow removal of a dirty journal from a filesystem, even if the filesystem needs recovery. e2fsck can then do its best to pick up the pieces. Addresses-Debian-Bug: #559301 Reported-by: Jim Faulkner <james.faulkner> Signed-off-by: Eric Sandeen <sandeen> Signed-off-by: "Theodore Ts'o" <tytso>
Built in e2fsprogs-1.41.12-19.el6
This problem is trigered under such condition: 1. ext3/ext4 file system with external journal device; 2. external journal device is lost; 3. the file system must get the "has_journal" and "needs_recovery" flag. I use the way of "freeze->thaw" the sepecified file system to add the "needs_recovery" flag to the distro system, and then do the reproduction and verification. With the e2fsprogs-1.41.4-el10, e2fsprogs-1.41.12-el14, e2fsprogs-1.41.12-el19, the problem is reproduced, shows as below: :: [ BEGIN ] :: Running 'tune2fs -f -O ^has_journal /tmp/18054data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1' :: [ PASS ] :: Command 'tune2fs -f -O ^has_journal /tmp/18054data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1' (Expected 0, got 0) :: [ BEGIN ] :: Running 'e2fsck /tmp/18054data.bk.img' e2fsck 1.41.12 (17-May-2010) e2fsck: need terminal for interactive repairs :: [ PASS ] :: Command 'e2fsck /tmp/18054data.bk.img' (Expected 2-12, got 8) :: [ BEGIN ] :: Running 'tune2fs -l /tmp/18054data.bk.img | grep has_journal 1>/dev/null 2>&1' With the e2fsprogs-1.41.12-el20, with the "-ff" option, the problem is fixed. The result is shown as below: : [ BEGIN ] :: Running 'tune2fs -f -O ^has_journal /tmp/21158data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1' :: [ PASS ] :: Command 'tune2fs -f -O ^has_journal /tmp/21158data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1' (Expected 0, got 0) :: [ BEGIN ] :: Running 'e2fsck /tmp/21158data.bk.img' e2fsck 1.41.12 (17-May-2010) e2fsck: need terminal for interactive repairs :: [ FAIL ] :: Command 'e2fsck /tmp/21158data.bk.img' (Expected 12, got 8) :: [ BEGIN ] :: Running 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1' :: [ PASS ] :: Command 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1' (Expected 0, got 0) :: [ BEGIN ] :: Running 'tune2fs -ff -O ^has_journal /tmp/21158data.bk.img' tune2fs: Invalid argument while trying to open external journal tune2fs 1.41.12 (17-May-2010) Journal removed :: [ PASS ] :: Command 'tune2fs -ff -O ^has_journal /tmp/21158data.bk.img' (Expected 0, got 0) :: [ BEGIN ] :: Running 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1' :: [ PASS ] :: Command 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1' (Expected 1, got 1) :: [ 14:26:12 ] :: [ INFO ] :: Verify the bug 1040122 successfully More info please check the beaker job: https://beaker.engineering.redhat.com/jobs/727330.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-1566.html