public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Goffredo Baroncelli <kreijack@inwind.it>
Cc: util-linux@vger.kernel.org,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	Chris Mason <chris.mason@fusionio.com>,
	Chris Murphy <lists@colorremedies.com>
Subject: Re: Btrfs: wipe all the superblock [redhat bugzilla 889888]
Date: Mon, 7 Jan 2013 17:33:27 +0100	[thread overview]
Message-ID: <20130107163327.GK20089@twin.jikos.cz> (raw)
In-Reply-To: <50E9C267.3050302@inwind.it>

On Sun, Jan 06, 2013 at 07:28:55PM +0100, Goffredo Baroncelli wrote:
> Currently wipefs doesn't clear all the superblock of btrfs. Only the first 
> one is cleared.
> 
> Btrfs has three superblocks. The first one is placed at 64KB, the second 
> one at 64MB, the third one at 256GB.

It can have as much as 4 superblock backup copies:

Superblock offset 0 is 65536 (0x10000, block=16/0x10)
Superblock offset 1 is 67108864 (0x4000000, block=16384/0x4000)
Superblock offset 2 is 274877906944 (0x4000000000, block=67108864/0x4000000)
Superblock offset 3 is 1125899906842624 (0x4000000000000, block=274877906944/0x4000000000)
Superblock offset 4 is 4611686018427387904 (0x4000000000000000, block=1125899906842624/0x4000000000000)

> If the first superblock is valid except that the "magic field" is zeroed,
> btrfs skips the check of the other superblocks.
> If the first superblock is fully invalid, btrfs checks for the other
> superblock.
> 
> So zeroing the first superblock "magic field" at the beginning seems
> that the filesystem is wiped. But when the first superblock is overwritten
> (e.g. by another filesystem), then the other two superblocks may be considered
> valid, and the filesystem may resurrect.

And for that purpose all the superblock copies should be taken into
account, regardless of the tricks that btrfs_mount applies.


david

  reply	other threads:[~2013-01-07 16:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 18:28 Btrfs: wipe all the superblock [redhat bugzilla 889888] Goffredo Baroncelli
2013-01-07 16:33 ` David Sterba [this message]
2013-01-07 18:20   ` Goffredo Baroncelli
2013-01-07 18:24     ` Hugo Mills
2013-01-07 18:33       ` Goffredo Baroncelli
2013-01-08 17:14     ` David Sterba
2013-01-08 15:48 ` Günter Gersdorf
2013-01-08 20:31   ` Goffredo Baroncelli
2013-01-09  8:09     ` Günter Gersdorf
2013-01-08 16:43 ` Karel Zak
2013-01-09 17:48   ` Goffredo Baroncelli
2013-01-09 18:10     ` Karel Zak
2013-01-08 18:01 ` Karel Zak
2013-01-08 20:09   ` Goffredo Baroncelli
2013-01-08 20:27     ` Chris Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130107163327.GK20089@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=chris.mason@fusionio.com \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox