From owner-freebsd-fs@freebsd.org Fri Feb 12 15:54:36 2021 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6174152817D for ; Fri, 12 Feb 2021 15:54:36 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay07.ispgateway.de (smtprelay07.ispgateway.de [134.119.228.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DcdNW55y2z3HGh for ; Fri, 12 Feb 2021 15:54:35 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [217.246.52.33] (helo=fabiankeil.de) by smtprelay07.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lAalo-0003P8-Jn for freebsd-fs@freebsd.org; Fri, 12 Feb 2021 16:54:12 +0100 Date: Fri, 12 Feb 2021 16:52:16 +0100 From: Fabian Keil To: freebsd-fs@freebsd.org Subject: Re: Reading a corrupted file on ZFS Message-ID: <20210212165216.2f613482@fabiankeil.de> In-Reply-To: <899c6b4f-2368-7ec2-4dfe-fa09fab35447@artem.ru> References: <0ca45adf-8f60-a4c3-6264-6122444a3ffd@denninger.net> <899c6b4f-2368-7ec2-4dfe-fa09fab35447@artem.ru> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/WF4+NeBpfYbcLLlvN=cPbGm"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Df-Sender: Nzc1MDY3 X-Rspamd-Queue-Id: 4DcdNW55y2z3HGh X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd-listen@fabiankeil.de has no SPF policy when checking 134.119.228.97) smtp.mailfrom=freebsd-listen@fabiankeil.de X-Spamd-Result: default: False [-2.19 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[134.119.228.97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.995]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[fabiankeil.de]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[134.119.228.97:from:127.0.2.255]; RWL_MAILSPIKE_POSSIBLE(0.00)[134.119.228.97:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RECEIVED_SPAMHAUS_PBL(0.00)[217.246.52.33:received]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:34011, ipnet:134.119.228.0/24, country:DE]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-fs]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Feb 2021 15:54:36 -0000 --Sig_/WF4+NeBpfYbcLLlvN=cPbGm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Artem Kuchin wrote on 2021-02-12: > 12.02.2021 18:06, Karl Denninger =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > Blocking the read forces you to get the good copy off backup media and= =20 > > thus prevents that from happening. > > >=20 > I know what ZFS does and i damaged the same file in the same place on=20 > purpose. Question is: how to read what's left of it. Just for kicks, i=20 > don't have a backup, and i need to read what's left. It could be 1GB=20 > file with only one byte damaged and it is of crazy importance to me. So,= =20 > how to bypass all the checks and make it read the file no matter what? The patch from this PR adds a sysctl that allows to send corrupted data: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221909 Using the added sysctl you can send and receive the dataset and then read the corrupted file from the received dataset. Note that ZFS replaces corrupted blocks completely with the 0x'zfs badd bloc' pattern instead of returning the corrupted data as is, thus increasing the amount of corruption in case of simple bit flips to whole blocks. Fabian --Sig_/WF4+NeBpfYbcLLlvN=cPbGm Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTKUNd6H/m3+ByGULIFiohV/3dUnQUCYCakMQAKCRAFiohV/3dU nbgHAKCNE42Eg9A9NaTaxXcOHXoN6ovMUwCdFVizioAAGCAH3TBWr8Wwy5BjzCw= =vdJC -----END PGP SIGNATURE----- --Sig_/WF4+NeBpfYbcLLlvN=cPbGm--