This episode covers storage security: LUKS and dm-crypt encryption above or below RAID, native ZFS encryption, key management, and the role of ZFS and btrfs checksums in detecting silent corruption through scrubbing.

Redundancy keeps the array running, backup keeps the data existing — but what protects data from the wrong hands? Episode 14 answers with encryption and integrity. A stolen disk, a seized server, or silently corrupted bits — each needs its own layer of protection.
In episode 11 we briefly touched on luks-on-raid versus raid-on-luks. Episode 14 covers it in depth, including native ZFS encryption, key management, and the checksums that set ZFS and btrfs apart from other filesystems. Let's start with the dm-crypt foundation.
LUKS (Linux Unified Key Setup) is the standard format for disk encryption on Linux, built on top of dm-crypt from the kernel. When you use LUKS above the array, the entire /dev/md0 is encrypted as one unit:
sudo cryptsetup luksFormat /dev/md0
sudo cryptsetup open /dev/md0 raid_cryptThe cryptsetup luksFormat /dev/md0 command creates a LUKS container (confirm YES and create a strong passphrase), then cryptsetup open opens it as a mapper named raid_crypt. Once opened, the filesystem is created at /dev/mapper/raid_crypt.
This approach offers simplicity:
The other side: if you want to move a single disk out of the array, that disk is useless on its own because it only contains encrypted slices of data. For that flexibility, you use raid-on-luks.
In this approach, each disk is encrypted on its own first, then combined into an array:
sudo cryptsetup luksFormat /dev/sdb
sudo cryptsetup luksFormat /dev/sdc
sudo cryptsetup open /dev/sdb crypt0
sudo cryptsetup open /dev/sdc crypt1
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/mapper/crypt0 /dev/mapper/crypt1The command sequence above creates LUKS on each disk, opens them as mappers, then builds the array from those mappers. The result: each disk is standalone and encrypted, and the array's data never appears in plaintext on any disk.
The main drawback: when a new disk replaces a failed one, you must create a fresh LUKS on the replacement with the same configuration. And at boot, every mapper needs to be opened — with many disks, this becomes cumbersome without keyfiles.
Info
For most cases, luks-on-raid is simpler and secure enough. Raid-on-luks suits you better if you want per-disk flexibility — for example moving disks between arrays without opening the whole container.
ZFS has built-in encryption that doesn't need dm-crypt:
sudo zfs create -o encryption=aes-256-gcm -o keyformat=passphrase tank/secretThe zfs create -o encryption=aes-256-gcm command creates an encrypted dataset with AES-256-GCM. The advantage: snapshots, replication, and compression all keep working normally on top of encrypted data — encryption is integrated with the ZFS ecosystem.
Native ZFS encryption brings major benefits:
ZFS keys can come from a passphrase, a keyfile, or auto-loaded at boot with tools like zfs-load-key and systemd:
sudo zfs load-key tank/secretThe zfs load-key tank/secret command loads the key into the kernel. For production, avoid passphrases that must be entered manually at every reboot; use a keyfile stored on a TPM or a separate key management server.
cryptsetup luksHeaderBackup saves the header containing the encryption keys; a corrupted header means unreadable data.sudo cryptsetup luksHeaderBackup /dev/md0 --header-backup-file /backup/luks-header.binThe cryptsetup luksHeaderBackup command saves the LUKS header to a backup file. Store this file on secure media — without the header, all encrypted data becomes unopenable.
Encryption protects against theft; checksums protect against corruption. ZFS and btrfs store a checksum per block, so when reading data, the filesystem can verify whether a block is still intact. This detects silent corruption — bit flips that hardware fails to catch.
sudo zpool status tankThe zpool status tank output shows an errors: column for every vdev. Any number other than zero indicates corrupted blocks were found. If ZFS has redundancy (mirror or RAIDZ), it repairs them automatically; if not, it reports the corruption — and that's when the backup from episode 12 comes into play.
A full checksum sweep is done through scrub — we'll cover how to schedule and run it in episode 15. For now, remember: checksums let ZFS and btrfs know when data is corrupted; plain RAID can't.
Episode 14 completed the storage security layer: LUKS and dm-crypt encryption above or below RAID, native ZFS encryption with tidy key management, and checksums for detecting silent corruption. Your data is now safe from theft and silent corruption.
Key takeaways:
zpool status shows checksum errors per vdev.In the next episode, episode 15, we'll discuss maintenance & scrub — running mdadm --check and --repair, zpool scrub, btrfs scrub, scheduling them routinely, plus physical care like UPS, disk aging, and firmware updates. You'll learn to keep storage healthy long-term.