linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: Cerem Cem ASLAN <ceremcem@ceremcem.net>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: How to ensure that a snapshot is not corrupted?
Date: Wed, 15 Aug 2018 07:35:36 -0400	[thread overview]
Message-ID: <8e8d23d9-ce7a-5f67-c8e1-d7c1d044178a@gmail.com> (raw)
In-Reply-To: <CAN4oSBd9aVn9Ruv83fd=oE4hJhGw7y3f1EbJ+SNbHMZZyZo=Mw@mail.gmail.com>

On 2018-08-10 06:07, Cerem Cem ASLAN wrote:
> Original question is here: https://superuser.com/questions/1347843
> 
> How can we sure that a readonly snapshot is not corrupted due to a disk failure?
> 
> Is the only way calculating the checksums one on another and store it
> for further examination, or does BTRFS handle that on its own?
> 
I've posted an answer for the linked question on SuperUser, under the 
assumption that it will be more visible to people simply searching for 
it there than it would be on the ML.

Here's the text of the answer though so people here can see it too:

There are two possible answers depending on what you mean by 'corrupted 
by a disk failure'.

### If you mean simple at-rest data corruption

BTRFS handles this itself, transparently to the user.  It checksums 
everything, including data in snapshots, internally and then verifies 
the checksums as it reads each block.  There are a couple of exceptions 
to this though:

* If the volume is mounted with the `nodatasum` or `nodatacow` options, 
you will have no checksumming of data blocks.  In most cases, you should 
not be mounting with these options, so this should not e an issue.
* Any files for which the `NOCOW` attribute is set (`C` in the output of 
the `lsattr` command) are also not checked.  You're not likely to have 
any truly important files with this attribute set (systemd journal files 
have it set, but that's about it unless you set it manually).

### If you mean non-trivial destruction of data on the volume because of 
loss of too many devices

You can't protect against this except by having another copy of the data 
somewhere.  Pretty much, if you've lost more devices than however many 
the storage profiles for the volume can tolerate, your data is gone, and 
nothing is going to get it back for you short of restoring from a backup.

      parent reply	other threads:[~2018-08-15 14:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 10:07 How to ensure that a snapshot is not corrupted? Cerem Cem ASLAN
2018-08-14 23:33 ` Hans van Kranenburg
2018-08-15 11:35 ` Austin S. Hemmelgarn [this message]

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=8e8d23d9-ce7a-5f67-c8e1-d7c1d044178a@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=ceremcem@ceremcem.net \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).