diff mbox

btrfsck failes

Message ID CAFP7zVsCBq6=+3jGFA-3BAAXUXeH1A72xM=GPG=88oZZdV5dPg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Holger Brandsmeier Jan. 16, 2014, 8:30 p.m. UTC
I agree to Marc, I created a small patch to `cmds-check.c` (see
attachments). It displays a warning message for 10 seconds if the
repair option is enabled. If you think this is a good idea, can
someone apply this patch?

I am going to roll in my backup soon. Is there anything more that I
should give you as a feedback? I did file one bug:

https://bugzilla.kernel.org/show_bug.cgi?id=68771

On Thu, Jan 16, 2014 at 1:19 PM, Marc MERLIN <marc@merlins.org> wrote:
> On Wed, Jan 15, 2014 at 10:16:13AM -0700, Chris Murphy wrote:
>>
>> On Jan 15, 2014, at 9:15 AM, Mitch Harder <mitch.harder@sabayonlinux.org> wrote:
>>
>> > On Mon, Jan 13, 2014 at 6:37 PM, Chris Murphy <lists@colorremedies.com> wrote:
>> >>
>> >> On Jan 13, 2014, at 3:58 PM, Holger Brandsmeier <brandsmeier@gmail.com> wrote:
>> >>>
>> >>> Currently btrfsck failes to repair my partition, I get the output:
>> >>>
>> >>> [root@ho-think bholger]# btrfsck --repair /dev/sda5
>> >>
>> >> This is almost the last resort and you probably should be posting to the list before using repair.
>> >>
>> >>
>> >
>> > This is like saying:
>> >
>> > "Yes, btrfs does now have a working btrfsck, but only for the select
>> > few who manage to get through on the mailing list for support."
>> >
>> > I'd like to think that's not the case.
>>
>> Yet that's exactly what the wiki suggests: "If you have a broken filesystem, it is probably better to use btrfsck with advice from one of the btrfs developers, just in case something goes wrong. (But even if it does go badly wrong, you've still got your backups, right?)"
>>
>> I think it's understandably annoying that the repair tool could make things worse rather than fail gracefully, because restoring from backups is tedious. But the only way it gets better is if people break both the file system and the repair tools in ways the devs can't possibly predict.
>
> I hate to be a broken record :) but telling people they should read/have
> read a wiki when they are in the middle of fixing a filesystem is not
> the right way to go.
> On my laptop while travelling, it would even be my only way to boot and
> maybe I can't get to the internet until my FS is fixed (maybe, maybe
> not, but you get the idea).
>
> My main point again (sorry) is still that the man page and usage info of btrfsck
> should really warn users "this is likely NOT what you want to run,
> please read the manpage, or HOWTO in /usr/share/doc/ with details about
> mount recovery and other things to try first".
>
> Think of it as a good thing, it means more btrfs users, and they are
> used to working a certain way. It's for btrfs to adapt to how they're
> used to working when possible.
>
> Marc
> --
> "A mouse is a device used to point at the xterm you want to type in" - A.S.R.
> Microsoft is to operating systems ....
>                                       .... what McDonalds is to gourmet cooking
> Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- cmds-check.c
+++ cmds-check.c
@@ -6427,6 +6427,15 @@  int cmd_check(int argc, char **argv)
        if (argc != 1)
                usage(cmd_check_usage);
 
+       if (repair != 0) {
+               printf("\nWARNING: you enabled repair mode, this option could make "
+                               "matters worse for your data. It is recommended to check with the "
+                               "linux-btrfs@vger.kernel.org mailing list before you proceed.\n");
+               printf("Sleeping for 10 seconds to give you time to consider..."
+                               " hit ctrl+c if you changed your mind.\n");
+               sleep(10);
+       }
+
        radix_tree_init();
        cache_tree_init(&root_cache);