One of my files on a pool has been marked as having a permanent error. I deleted it. However, I can't get ZFS to forget about it. I've rebooted, rescrubbed, etc.
zpool clear will clear the cksum numbers, until a scrub finds the error again.
Originally the file was a video file: Shaun.The.Sheep.S02E02_Hiccups.avi
I don't much care about the kids cartoons, I have the DVD anyway.
So, what have I done?
Normal status check to find the file:
- Code: Select all
alex@smiley:~|⇒ zpool status -v
pool: ZFS
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://zfsonlinux.org/msg/ZFS-8000-8A
scan: scrub repaired 0 in 10h4m with 1 errors on Tue Oct 21 10:36:17 2014
config:
NAME STATE READ WRITE CKSUM
ZFS ONLINE 0 0 1
mirror-0 ONLINE 0 0 0
disk6 ONLINE 0 0 0
disk5 ONLINE 0 0 0
mirror-1 ONLINE 0 0 2
disk7 ONLINE 0 0 2
disk4 ONLINE 0 0 2
mirror-2 ONLINE 0 0 2
disk2 ONLINE 0 0 2
disk3 ONLINE 0 0 2
errors: Permanent errors have been detected in the following files:
ZFS/Media:<0x113bf3>
ok, that's normal for a deleted file.
Note, this is freshly scrubbed. This error happened months ago, now it's bugging me so I'm trying to fix it. I scrub weekly.
We can look up the inode information with zdb:
- Code: Select all
alex@smiley:~|⇒ zdb -ddddd ZFS/Media 0x113bf3
Dataset ZFS/Media [ZPL], ID 62, cr_txg 83, 2.28T, 979515 objects, rootbp DVA[0]=<1:e830d20000:1000> DVA[1]=<2:2543466f000:1000> [L0 DMU objset] fletcher4 lzjb LE contiguous unique double size=800L/200P birth=4102431L/4102431P fill=979515 cksum=19bc47bf6b:7cca3c9411e:14b5b20d91238:278b4b4674310c
Object lvl iblk dblk dsize lsize %full type
1129459 1 16K 512 8K 512 100.00 ZFS directory
168 bonus System attributes
dnode flags: USED_BYTES USERUSED_ACCOUNTED
dnode maxblkid: 0
path ???<object#1129459>
uid 502
gid 20
atime Mon Mar 10 12:13:52 2014
mtime Mon Mar 10 12:13:52 2014
ctime Sat Mar 15 17:10:29 2014
crtime Mon Mar 10 12:13:52 2014
gen 51827
mode 41777
size 3
parent 1129458
links 0
pflags 40800000145
Indirect blocks:
0 L0 1:ec7c409000:1000 200L/200P F=1 B=51827/51827
segment [0000000000000000, 0000000000000200) size 512
ok, so, this is a ZFS directory, that might come in handy. We also know it's location on disk. We can pull the actual file information with ZDB:
- Code: Select all
alex@smiley:~|⇒ sudo zdb -R ZFS/Media 1:ec7c409000:1000:r
Found vdev type: mirror
���ݰ�;�com.apple.quarantine%
So, this is from a mirror, yes, it is, all three vdevs are mirrors.
There are no snapshots on this filesystem.
The file is blank expect for this com.apple.quarantine, which is a special flag (extended attribute) on the file apple sets when a file is downloaded. It gives that annoying "This file was downloaded, are you sure you want to open it" prompt.
This explains why it's a ZFS directory file. I believe that extended attributes were originally implemented in ZFS using ZFS directories to represent the file containing the file and the attributes. Could that be the case here?
Could it be that when the file was corrupted that the file was deleted by me, somehow leaving the corrected attribute behind?
I've tried to recreate the file and delete it:
sudo zdb -R ZFS/Media 1:ec7c409000:1000:r > Shaun.The.Sheep.S02E02_Hiccups.avi
But, that doesn't do anything. I've had the recreated file hanging around for several scrubs. Possibly because this isn't a regular file.
Anyway, I don't care about the file, I just want to remove all record of it from ZFS so it'll be happy again.