From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f180.google.com ([209.85.213.180]:37227 "EHLO mail-ig0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932317AbbJULvq (ORCPT ); Wed, 21 Oct 2015 07:51:46 -0400 Received: by igbhv6 with SMTP id hv6so35714907igb.0 for ; Wed, 21 Oct 2015 04:51:46 -0700 (PDT) Subject: Re: Expected behavior of bad sectors on one drive in a RAID1 To: Duncan <1i5t5.duncan@cox.net>, linux-btrfs@vger.kernel.org References: <201510201545.50705.russell@coker.com.au> <56263B0B.4050502@gmail.com> <201510210015.54337.russell@coker.com.au> <562648B5.2020401@gmail.com> <56269D1C.5080006@gmail.com> From: Austin S Hemmelgarn Message-ID: <56277C4A.70300@gmail.com> Date: Wed, 21 Oct 2015 07:51:38 -0400 MIME-Version: 1.0 In-Reply-To: <56269D1C.5080006@gmail.com> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-512; boundary="------------ms090003060204070102020907" Sender: linux-btrfs-owner@vger.kernel.org List-ID: This is a cryptographically signed message in MIME format. --------------ms090003060204070102020907 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 2015-10-20 15:59, Austin S Hemmelgarn wrote: > On 2015-10-20 15:20, Duncan wrote: >> Yes, there's some small but not infinitesimal chance the checksum may = be >> wrong, but if there's two copies of the data and the checksum on one i= s >> wrong while the checksum on the other verifies... yes, there's still t= hat >> small chance that the one that verifies is wrong too, but that it's an= y >> worse than the one that does not verify? /That's/ getting close to >> infinitesimal, or at least close enough for the purposes of a mailing-= >> list claim without links to supporting evidence by someone who has >> already characterized it as not mathematically rigorous... and for me,= >> personally. I'm not spending any serious time thinking about getting = hit >> by lightening, either, tho by the same token I don't go out flying kit= es >> or waving long metal rods around in lightning storms, either. > With a 32-bit checksum and a 4k block (the math is easier with smaller > numbers), that's 4128 bits, which means that a random single bit error > will have a approximately 0.24% chance of occurring in a given bit, > which translates to an approximately 7.75% chance that it will occur in= > one of the checksum bits. For a 16k block it's smaller of course > (around 1.8% I think, but that's just a guess), but it's still > sufficiently statistically likely that it should be considered. As mentioned in my other reply to this, I did the math wrong (bit of a=20 difference between kilobit and kilobyte), so here's a (hopefully)=20 correct and more thorough analysis: For 4kb blocks (32768 bits): There are a total of 32800 bits when including a 32 bit checksum outside = the block, this makes the chance of a single bit error in either the=20 block or the checksum ~0.30%. This in turn means an approximately 9.7%=20 chance of a single bit error in the checksum. For 16kb blocks (131072 bits): There are a total of 131104 bits when including a 32 bit checksum=20 outside the block, this makes the chance of a single bit error in either = the block or the checksum ~0.07%. This in turn means an approximately=20 2.4% chance of a single bit error in the checksum. This all of course assumes a naive interpretation of how modern block=20 storage devices work. All modern hard drives and SSD's include at a=20 minimum the ability to correct single bit errors per byte, and detect=20 double bit errors per byte, which means that we need a triple bit error=20 in the same byte to get bad data back, which in turn makes the numbers=20 small enough that it's impractical to represent them without scientific=20 notation (on the order of 10^-5). That in turn assumes zero correlation beyond what's required to get bad=20 data back from the storage, however, if there is enough correlation for=20 that to happen, it's statistically likely that there will be other=20 errors very close by. This in turn means that it's more likely that the = checksum is either correct or absolutely completely wrong, which=20 increases the chances that the resultant metadata block containing the=20 checksum will nnot appear to have an incorrect checksum itself (because=20 checksums are good at detecting proportionately small errors, but only=20 mediocre at detecting very big errors). The approximate proportionate chances of an error in the data versus the = checksum however are still roughly the same however, irrespective of how = small the chances of getting any error are. Based on this, the ratio of = the size of the checksum to the size of the data is a tradeoff that=20 needs to be considered, the closer the ratio is to 1, the higher the=20 chance of having an error in the checksum, but the less data you need to = correct/verify when there is an error. --------------ms090003060204070102020907 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwEAAKCC Brgwgga0MIIEnKAD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