Why my home server runs ZFS instead of RAID

I planned a three-disk mdadm RAID 5 and built a ZFS raidz1 pool instead. What OpenMediaVault and ZFS look like in practice, and what the switch cost.

6 min read
Angled close-up of two stacked rackmount servers, each with a row of hot-swap drive caddies labelled 600GB 10K beside empty bays, green status LEDs lit above the drives and the background blurred
Photo by panumas nikhomkhai on Pexels (Pexels License)

Part one planned the storage as mdadm RAID 5, started with one disk and grown one drive at a time. By the end of part three that plan was gone. The array that holds my family’s files is a ZFS raidz1 pool of three 4 TB WD Red Plus drives, the one from part one plus two bought together later, and it went in before a single byte landed on the disks.

This is part four of the home server series. Here is why I changed my mind, and what ZFS costs compared with the boring RAID I had planned.

Installing OpenMediaVault and adding ZFS

The install was the uneventful part. I wrote the OpenMediaVault ISO to a USB stick, booted it and installed onto the 1 TB NVMe. The root filesystem is plain ext4. The NVMe also holds every container’s config, database and cache under /srv/appdata, because databases want low-latency random IO and hard drives are bad at it.

ZFS does not ship with OpenMediaVault. It comes from omv-extras, the community plugin repository, as the openmediavault-zfs plugin. With the plugin installed, the pool and its datasets are created and managed in the same web UI as everything else.

The split is the whole design. App state lives on the NVMe; user files, photos and media live on the ZFS pool tank. Only the second half needed a decision.

What RAID 5 cannot tell you

The reason I left mdadm is one it cannot fix: it does not know when your data is wrong.

RAID 5 stores parity so it can rebuild a disk that died. It does not store a checksum of your data. If a drive silently returns a bad block, the array hands it to you as if it were good. A consistency check can notice that data and parity disagree, but it cannot tell which one is wrong, so it rewrites the parity to match. The corruption becomes official.

ZFS checksums every block it writes and verifies it on every read. When a block fails its checksum on a raidz pool, ZFS rebuilds it from parity, returns the correct data and rewrites the bad copy. A scheduled scrub does the same for the whole pool, including files nobody has opened in years. For a pool that will mostly hold family photos and documents, data that sits untouched for a decade and has to be right when someone finally opens it, that was the deciding argument.

ZFS is also copy-on-write, so it does not suffer the RAID 5 write hole: a power cut halfway through a stripe update cannot leave data and parity out of step.

Datasets instead of folders

The second reason was datasets. A ZFS pool is not one big filesystem. It holds many, each with its own properties, snapshots and space accounting. Mine are split by workload: tank/media, tank/photos, tank/nextcloud, tank/downloads, tank/backups and a few more.

Every dataset inherits sensible pool defaults: compression=lz4, atime=off, xattr=sa. Where a workload differs, the dataset says so. tank/photos uses recordsize=1M because it holds large photo and video files, while everything else keeps the default 128K. On mdadm with ext4, that would mean separate partitions or no tuning at all.

Snapshots were the third reason, and I have to be honest about them. They are cheap, per-dataset and instant, and they are exactly what undoes a bad rm -rf. I do not have any scheduled yet. They are on the list; backups run on restic to an off-site Raspberry Pi, because a pool that survives a dead disk does not survive a fire.

What ZFS costs

ZFS is not free, and the comparison is not one-sided.

mdadm RAID 5 + ext4ZFS raidz1
Detects silent corruptionNoYes, every read and every scrub
Repairs itNoYes, from parity
SnapshotsNeeds LVM on topBuilt in, per dataset
Grow by one diskAny time, reshape in placeSince OpenZFS 2.3, with caveats
Remove a disk from the arrayPossibleNot from raidz
RAM appetiteSmallARC takes what you give it
Kernel supportIn mainline LinuxOut-of-tree module

Memory. ZFS caches reads in its ARC, and on a 16 GB machine running Nextcloud, Immich and Jellyfin, RAM is the tightest resource. I capped the ARC at 6 GiB. With it full, about 6.4 GiB remain for everything else.

The kernel module. ZFS is not part of the Linux kernel, for licensing reasons. The host runs Debian’s stock kernel, so the module is built against it, and a kernel update is one more thing that has to go right. mdadm has been in mainline for decades.

Growth. This is what part one was built around. mdadm adds a disk to a RAID 5 and reshapes it, whenever you like. OpenZFS gained raidz expansion in 2.3, but existing data keeps its old data-to-parity ratio until it is rewritten, and you cannot take a disk back out of a raidz vdev. ZFS rewards deciding the shape of the pool up front, so I settled on three disks before creating it and left the fourth bay free.

Datasets cut both ways. Downloads and media are separate datasets on the same pool, so when Sonarr or Radarr imports a file it is a full copy, not a hardlink or an instant move. Acceptable for now, and a direct consequence of splitting things up.

Why raidz1 and not a mirror. Capacity per euro. Three 4 TB disks in raidz1 give about 7.3 TB usable and survive one dead drive. A mirror of two would give 4 TB. The price is single parity: during a rebuild, a second failure loses the pool.

That risk is not evenly spread. Drives from the same manufacturing batch tend to fail together, and a rebuild that reads every surviving disk end to end is exactly the stress that tips a weak one over. The usual advice is to buy drives for one array from different batches. I half followed it by accident: the first drive came on its own, but the other two were bought together and are the same model, so they are most likely a pair from one batch. One more reason the backups exist.

The takeaway

If you are choosing between mdadm and ZFS for a home server, decide based on what the data is. For media you could download again, mdadm is simpler, lighter and grows easily. For photos and documents that have to stay correct for years, choose ZFS, and decide the pool’s shape before you buy the drives, because changing it afterwards is the one thing ZFS makes hard.

Further reading

The rest of the series: part one, the parts list; part two, the chassis that did not fit; part three, the finished build.


← All posts