Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Feb 2021 17:53:58 +0300
From:      Artem Kuchin <artem@artem.ru>
To:        freebsd-fs@freebsd.org
Subject:   Reading a corrupted file on ZFS
Message-ID:  <da892eeb-233f-551f-2faa-62f42c3c1d5b@artem.ru>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?da892eeb-233f-551f-2faa-62f42c3c1d5b>