Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* should btrfsck fix a bad superblock?
@ 2015-12-29  0:10 Chris Murphy
  2015-12-29  2:28 ` Duncan
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Murphy @ 2015-12-29  0:10 UTC (permalink / raw)
  To: Btrfs BTRFS

Hi,

I (intentionally) used wipefs -a on a device with a btrfs. As expected
btrfs check doesn't recognize the device as having a btrfs volume
anymore.

Slightly surprising that it doesn't mention other intact supers are found.

Most surprising that options -s1 --repair doesn't fix it.

I thought maybe it's intentional, only with explicitly bad magic, and
I'd get different results if it were zero'd. So I zero'd it and I get
the same results. s0 superblock isn't repaired with --repair.

Bug?

Of course I can fix it with echo+dd.


-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: should btrfsck fix a bad superblock?
  2015-12-29  0:10 should btrfsck fix a bad superblock? Chris Murphy
@ 2015-12-29  2:28 ` Duncan
  2015-12-29  2:46   ` Chris Murphy
  2015-12-29 17:19   ` David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: Duncan @ 2015-12-29  2:28 UTC (permalink / raw)
  To: linux-btrfs

Chris Murphy posted on Mon, 28 Dec 2015 17:10:14 -0700 as excerpted:

> Hi,
> 
> I (intentionally) used wipefs -a on a device with a btrfs. As expected
> btrfs check doesn't recognize the device as having a btrfs volume
> anymore.
> 
> Slightly surprising that it doesn't mention other intact supers are
> found.
> 
> Most surprising that options -s1 --repair doesn't fix it.
> 
> I thought maybe it's intentional, only with explicitly bad magic, and
> I'd get different results if it were zero'd. So I zero'd it and I get
> the same results. s0 superblock isn't repaired with --repair.
> 
> Bug?
> 
> Of course I can fix it with echo+dd.

Btrfs check's -s option simply lets you use a different superblock.  I 
don't believe check is designed to actually fix superblocks, tho I guess 
with --repair it fixes certain bad fields in them.

What you want to actually recover bad superblocks from good copies is 
btrfs rescue super-recover.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: should btrfsck fix a bad superblock?
  2015-12-29  2:28 ` Duncan
@ 2015-12-29  2:46   ` Chris Murphy
  2015-12-29  2:58     ` Chris Murphy
  2015-12-29 17:19   ` David Sterba
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Murphy @ 2015-12-29  2:46 UTC (permalink / raw)
  To: Duncan; +Cc: Btrfs BTRFS

On Mon, Dec 28, 2015 at 7:28 PM, Duncan <1i5t5.duncan@cox.net> wrote:
> Chris Murphy posted on Mon, 28 Dec 2015 17:10:14 -0700 as excerpted:
>
>> Hi,
>>
>> I (intentionally) used wipefs -a on a device with a btrfs. As expected
>> btrfs check doesn't recognize the device as having a btrfs volume
>> anymore.
>>
>> Slightly surprising that it doesn't mention other intact supers are
>> found.
>>
>> Most surprising that options -s1 --repair doesn't fix it.
>>
>> I thought maybe it's intentional, only with explicitly bad magic, and
>> I'd get different results if it were zero'd. So I zero'd it and I get
>> the same results. s0 superblock isn't repaired with --repair.
>>
>> Bug?
>>
>> Of course I can fix it with echo+dd.
>
> Btrfs check's -s option simply lets you use a different superblock.  I
> don't believe check is designed to actually fix superblocks, tho I guess
> with --repair it fixes certain bad fields in them.
>
> What you want to actually recover bad superblocks from good copies is
> btrfs rescue super-recover.

Yep! I forgot about that. But it's still confusing that particular
repair is split out.



-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: should btrfsck fix a bad superblock?
  2015-12-29  2:46   ` Chris Murphy
@ 2015-12-29  2:58     ` Chris Murphy
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Murphy @ 2015-12-29  2:58 UTC (permalink / raw)
  To: Btrfs BTRFS

On Mon, Dec 28, 2015 at 7:46 PM, Chris Murphy <lists@colorremedies.com> wrote:
> On Mon, Dec 28, 2015 at 7:28 PM, Duncan <1i5t5.duncan@cox.net> wrote:
>> Chris Murphy posted on Mon, 28 Dec 2015 17:10:14 -0700 as excerpted:
>>
>>> Hi,
>>>
>>> I (intentionally) used wipefs -a on a device with a btrfs. As expected
>>> btrfs check doesn't recognize the device as having a btrfs volume
>>> anymore.
>>>
>>> Slightly surprising that it doesn't mention other intact supers are
>>> found.
>>>
>>> Most surprising that options -s1 --repair doesn't fix it.
>>>
>>> I thought maybe it's intentional, only with explicitly bad magic, and
>>> I'd get different results if it were zero'd. So I zero'd it and I get
>>> the same results. s0 superblock isn't repaired with --repair.
>>>
>>> Bug?
>>>
>>> Of course I can fix it with echo+dd.
>>
>> Btrfs check's -s option simply lets you use a different superblock.  I
>> don't believe check is designed to actually fix superblocks, tho I guess
>> with --repair it fixes certain bad fields in them.
>>
>> What you want to actually recover bad superblocks from good copies is
>> btrfs rescue super-recover.
>
> Yep! I forgot about that. But it's still confusing that particular
> repair is split out.

OK so the warning I get from rescue super-recover makes this make sense:

[root@f23m ~]# btrfs rescue super-recover /dev/sdb
Make sure this is a btrfs disk otherwise the tool will destroy other
fs, Are you sure? [y/N]: n


It looks like it's a rudimentary check for only btrfs superblocks and
isn't checking if the fs could plausibly be some other file system,
which is admittedly quite a burden for any tool to have to do.

-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: should btrfsck fix a bad superblock?
  2015-12-29  2:28 ` Duncan
  2015-12-29  2:46   ` Chris Murphy
@ 2015-12-29 17:19   ` David Sterba
  1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2015-12-29 17:19 UTC (permalink / raw)
  To: Duncan; +Cc: linux-btrfs

On Tue, Dec 29, 2015 at 02:28:19AM +0000, Duncan wrote:
> Btrfs check's -s option simply lets you use a different superblock.  I 
> don't believe check is designed to actually fix superblocks, tho I guess 
> with --repair it fixes certain bad fields in them.

The superblock is a special type of metadata, 'btrfs check' works on the
the trees pointed by it. There's the super-recover command you mentioned
and also the (still) standaone btrfs-select-super tool that are supposed
to fix the superblock itself.

Similarly, check may find specific problems, will not attempt to fix all
of them and could suggest to use a specialized fix tool. The reasons are
to avoid overbloating the checker command line options. An example is
the b-tree key bitflip fix (code not merged yet).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-29 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-29  0:10 should btrfsck fix a bad superblock? Chris Murphy
2015-12-29  2:28 ` Duncan
2015-12-29  2:46   ` Chris Murphy
2015-12-29  2:58     ` Chris Murphy
2015-12-29 17:19   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox