Reading a corrupted file on ZFS

Don Lewis truckman at FreeBSD.org
Sat Feb 13 00:12:14 UTC 2021


On 12 Feb, Fabian Keil wrote:
> Artem Kuchin <artem at artem.ru> wrote on 2021-02-12:
> 
>> 12.02.2021 18:06, Karl Denninger пишет:
> 
>> > Blocking the read forces you to get the good copy off backup media and 
>> > thus prevents that from happening.
>> >
>> 
>> I know what ZFS does and i damaged the same file in the same place on 
>> purpose. Question is: how to read what's left of it. Just for kicks, i 
>> don't have a backup, and i need to read what's left. It could be 1GB 
>> file with only one byte damaged and it is of crazy importance to me. So, 
>> 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=221909
> 
> 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.

Compression, which defaults to being used, also will increase the amount
of corruption.



More information about the freebsd-fs mailing list