Sunday, May 17, 2015

ZFS on Linux - ignore data errors when sending snapshots

This applies to the native implementation of ZFS for Linux (see http://zfsonlinux.org/)

The Issue:

A zpool experienced data-corruption and you want to save your pool's data by sending it to another working pool via zfs send/receive.
Sadly, zfs send will abort when it detects errors on the pool (CKSUM, READ).

The solution:

Luckily, the devs of ZFS on Linux (ZoL) added a tuneable to allow zfs send to continue in such a case. (See https://github.com/zfsonlinux/zfs/issues/3422)

To sum it up: simply set the tunable "zfs_send_corrupt_data" for the zfs kernel module:

on the fly:
echo 1 > /sys/module/zfs/parameters/zfs_send_corrupt_data

for permanent use, create file "/etc/modprobe.d/zfs.conf" with this content:
options zfs zfs_send_corrupt_data=1