HDD bad sector marking through LUKS2 layer (dm-crypt) + ZFS
If having 2x LUKS-encrypted HDDs with a ZFS mirror pool on top of the dm-crypt mapper devices: what happens if one of my HDDs encounters an error and the OS recognizes a sector as bad ?
Will this bad sector information be passed to the encryption-layer and as such be there on the mapper device marked 'bad' as well ? (The corresponding-affected block of course).
(So that the ZFS layer on top of the encrypted device can see this and correct the error via internal mechanisms during access or during a scrubbing. No ZFS encryption - by intention. Yet).
Debian/Ubuntu.
Solution 1:
If a sector goes bad, LUKS would return an error - which will be corrected by ZFS (thanks to the other mirror leg).
If a sector return bad data, LUKS can decrypt an incorrect payload - which will be again correct by ZFS (thanks to checksum and mirroring).
In other words: with a ZFS mirror your data should be safe, unless both mirror legs are corrupted.