Reading a corrupted file on ZFS

Ryan Moeller ryan at ixsystems.com
Fri Feb 19 22:21:01 UTC 2021


Recovering files with zdb recently became quite a bit easier if you're
on CURRENT:
https://github.com/openzfs/zfs/pull/11027

-Ryan

On Thu, Feb 18, 2021 at 8:09 PM Jeremy Faulkner <gldisater at gmail.com> wrote:
>
> 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 at 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 at 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 at freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> > To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
>
> --
> --
> Jeremy Faulkner
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"



-- 
Ryan Moeller
iXsystems, Inc.
OS Developer
Email: ryan at iXsystems.com


More information about the freebsd-fs mailing list