Reading a corrupted file on ZFS

Stefan Esser se at freebsd.org
Mon Feb 15 11:40:32 UTC 2021


Am 13.02.21 um 17:54 schrieb Karl Denninger:
> On 2/13/2021 11:51, Stefan Esser wrote:
>> Therefore: There are valid reasons to not have redundancy and
>> still not loose a large file of data for single bad block of a
>> non-redundant (e.g striped for performance) ZPOOL/ZFS.
>>
>> Regards, STefan
>>
> That's what the patch does -- it allows you to read the file but the 
> known-bad blocks will be "blanked" (marked that it's no good.)

Yes, I'm well aware of that fact.

I just think we should allow those in this particular error case an
easy way out - and in fact I just noticed that we already do!

> Perhaps that sysctl should be part of the system generally, but you CAN 
> do it the hard way with zdb even without it although it's a SERIOUS pain 
> in the neck.

While possible with ZDB, nobody will want to do this, if a simple
alternative exists:

$ sysctl vfs.zfs.send
vfs.zfs.send.override_estimate_recordsize: 0
vfs.zfs.send.no_prefetch_queue_ff: 20
vfs.zfs.send.queue_ff: 20
vfs.zfs.send.no_prefetch_queue_length: 1048576
vfs.zfs.send.unmodified_spill_blocks: 1
vfs.zfs.send.queue_length: 16777216
vfs.zfs.send.corrupt_data: 0

These are due to the following lines at the end of
/sys/contrib/openzfs/module/zfs/dmu_send.c:

/* BEGIN CSTYLED */
ZFS_MODULE_PARAM(zfs_send, zfs_send_, corrupt_data, INT, ZMOD_RW,
	"Allow sending corrupt data");

ZFS_MODULE_PARAM(zfs_send, zfs_send_, queue_length, INT, ZMOD_RW,
	"Maximum send queue length");
[...]

Just set vfs.zfs.send.corrupt_data to 1 to have unreadable blocks
returned filled with 0x2f5baddb10c (not 0 as suggested in this thread).

This has been a standard feature of ZFSonLinux for more than 6 years,
apparently, and we have got it with the mapping of module parameters
to sysctl variables ...

Regards, STefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20210215/5276249a/attachment.sig>


More information about the freebsd-fs mailing list