# create
dd if=/dev/zero of=/tmp/sparse_file bs=1 count=0 seek=512M
sudo losetup /dev/loop10 /tmp/sparse_file
sudo zpool create test /dev/loop10
sudo zpool status test
# write
sudo zfs create test/fs
sudo dd if=/dev/urandom of=/test/fs/bigfile bs=1M count=400 status=progress
sync
# corrupt
sudo dd if=/dev/urandom of=/dev/loop10 bs=1M count=10 seek=150 conv=notrunc
# scrub
sudo zpool scrub test
sudo zpool status -v test pool: test
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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
scan: scrub repaired 3K in 00:00:00 with 80 errors on Fri Oct 31 19:11:44 2025
config:
NAME STATE READ WRITE CKSUM
test ONLINE 0 0 0
loop10 ONLINE 0 0 164
errors: Permanent errors have been detected in the following files:
/test/fs/bigfile
=> email should have been sent
#cleanup
sudo zfs destroy -r test/fs
sudo zpool destroy test
sudo losetup -d /dev/loop10
rm -f /tmp/sparse_file