Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Feb 2021 20:08:51 -0500
From:      Jeremy Faulkner <gldisater@gmail.com>
To:        freebsd-fs@freebsd.org
Subject:   Re: Reading a corrupted file on ZFS
Message-ID:  <92c03e85-4014-b5ee-17a5-bac3902678cb@gmail.com>
In-Reply-To: <da892eeb-233f-551f-2faa-62f42c3c1d5b@artem.ru>
References:  <da892eeb-233f-551f-2faa-62f42c3c1d5b@artem.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
ZDB can be used to pull individual blocks out of a zpool to allow you to 
piece together what's left of your file.

https://www.youtube.com/watch?v=y7gQwypNMdk

https://gist.github.com/mdimura/5aa4c163a7e0856b3712b6a880670678

On 2021-02-12 9:53 a.m., Artem Kuchin wrote:
> I did a little experiment
> 
> I have a mirror ZFS pool called ZDATA, i created a file and damanged the 
> same byte in file in it on both disks.
> 
> File has ABCDEF string.
> 
> 
>          ZDATA       ONLINE       0     0     0
>            mirror-0  ONLINE       0     0     0
>              ada0    ONLINE       0     0     1
>              ada1    ONLINE       0     0     0
> 
> 
> destroy ZDATA
> 
> on ada0 change A to Z
> on ada1 change A to Y
> reimport
> 
> root@xigmanas:~# zpool status
>    pool: ZDATA
>   state: ONLINE
>    scan: scrub repaired 24K in 0 days 00:03:01 with 0 errors on Fri Feb 
> 12 16:48:46 2021
> config:
> 
>          NAME        STATE     READ WRITE CKSUM
>          ZDATA       ONLINE       0     0     0
>            mirror-0  ONLINE       0     0     0
>              ada0    ONLINE       0     0     0
>              ada1    ONLINE       0     0     0
> 
> errors: No known data errors
> 
> Hmm. it repaired something. Read data from disks.
> ada0 - Z
> ada1 - Y
> so, that repair was not the rotten bytes.
> 
> Now run scrub
> 
> root@xigmanas:~# zpool status -v ZDATA
>    pool: ZDATA
>   state: ONLINE
> status: One or more devices has experienced an error resulting in data
>          corruption.  Applications may be affected.
> action: Restore the file in question if possible.  Otherwise restore the
>          entire pool from backup.
>     see:http://illumos.org/msg/ZFS-8000-8A  
> <http://illumos.org/msg/ZFS-8000-8A>;
>    scan: scrub repaired 0 in 0 days 00:03:02 with 1 errors on Fri Feb 12 
> 16:59:49 2021
> config:
> 
>          NAME        STATE     READ WRITE CKSUM
>          ZDATA       ONLINE       0     0     1
>            mirror-0  ONLINE       0     0     2
>              ada0    ONLINE       0     0     2
>              ada1    ONLINE       0     0     2
> 
> errors: Permanent errors have been detected in the following files:
> 
>          /data/DATASET1/test.file
> 
> the data is still Z and Y, not sync-ed.
> 
> I cannot read or write this file. This is bad.
> 
> zfs set checksum=off ZDATA
> 
> did not help, still cannot read or write the file.
> 
> zpool clear -F ZDATA
> 
> still cannot r/w the file
> 
> Now i am stuck in worst situation that with UFS - i cannot read what's 
> left of this file.
> 
> I deleted the file and the scrubbed - error went away. But i lost the file.
> 
> So, the question is how to read the file with an error ? I googled for 2 
> hours and still did not find a solution.
> 
> 
> Artem
> 
> _______________________________________________
> freebsd-fs@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"

-- 
--
Jeremy Faulkner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?92c03e85-4014-b5ee-17a5-bac3902678cb>