Reading a corrupted file on ZFS
Artem Kuchin
artem at artem.ru
Fri Feb 12 14:54:03 UTC 2021
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
More information about the freebsd-fs
mailing list