linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugo Mills <hugo@carfax.org.uk>
To: Jaromir Zdrazil <jaromir.zdrazil@email.cz>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: data integrity in btrfs
Date: Fri, 30 Dec 2011 13:38:26 +0000	[thread overview]
Message-ID: <20111230133826.GA2509@carfax.org.uk> (raw)
In-Reply-To: <135528.24428.61333-23184-1070446607-1325251786@email.cz>

[-- Attachment #1: Type: text/plain, Size: 1742 bytes --]

On Fri, Dec 30, 2011 at 02:29:46PM +0100, Jaromir Zdrazil wrote:
> Hi again,
> 
>    I know that ZFS include data integrity verification against data corruption modes using propably SHA256.
> 
>    By sketchy readings at https://btrfs.wiki.kernel.org/index.html , http://en.wikipedia.org/wiki/Btrfs and other sources I have found just that there is Sha32C used and that it should be similar to ZFS.
> 
>    How are data faults detected and repaired ni BRTFS? If the answer could be simple and precize, I would be more than happy.
> 
> Thank you! Gone to lunch ;O)

   Every 4k block in btrfs is checksummed (using CRC32, so it's not
cryptographically robust against malicious modification, but should
spot most random errors).

   If you use RAID-1 or RAID-10 storage, then you get two copies of
each piece of data, stored on different devices. Each copy is
independently checksummed. When data is read, the checksum is verified
as well, and a failed checksum is logged to syslog. In this case, the
filesystem will attempt to read the other copy. If both copies are
bad, an I/O error is returned; if one of the copies is good, that data
is returned.

   With recent kernels and an up-to-date userspace, there is a feature
called scrub which will read both copies of all of the data blocks in
the filesystem and compare them to each other. If there is a mismatch
with a failed checksum, scrub will rewrite the broken block to fix it.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
       --- "Are you the man who rules the Universe?" "Well,  I ---       
                              try not to."                               

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2011-12-30 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-30 13:29 data integrity in btrfs Jaromir Zdrazil
2011-12-30 13:38 ` Hugo Mills [this message]
2011-12-30 13:44 ` Kai Krakow

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=20111230133826.GA2509@carfax.org.uk \
    --to=hugo@carfax.org.uk \
    --cc=jaromir.zdrazil@email.cz \
    --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).