The ZFS vs RAID decision comes down to one thing: ZFS checksums every block and knows which copy is correct, so it can repair silent corruption, while mdadm and hardware RAID usually only know that copies disagree. ZFS is a filesystem, volume manager and RAID layer combined, and it adds snapshots, compression and replication on top. Use it for bulk storage and anything where data integrity comes first. Use mdadm with XFS or ext4 when you want the simplest kernel-native stack or the lowest NVMe write latency. Use hardware RAID mainly when the operating system leaves you no good software option.

Checksums: the difference that matters

Traditional RAID sits below the filesystem and sees numbered blocks. It has no way of knowing whether a block's content is right. Take a Linux md mirror where one drive returns different data from its partner: the md(4) man page describes a check scrub that counts the mismatch in mismatch_cnt, and a repair scrub that overwrites all copies but one with the contents of that one. On RAID 5 and 6, repair writes new parity. Neither action involves any evidence about which data was correct. If the bad copy gets chosen, the corruption becomes permanent.

ZFS stores each block's checksum in its parent block, up to the root of the tree. On every read it verifies the checksum, and if verification fails on a redundant vdev, it reads another copy or reconstructs from parity, confirms that result against the checksum, and rewrites the bad sector. Applications never see the wrong data. zpool status shows it as a count in the CKSUM column, which tells you when a drive, cable or HBA has started to misbehave, long before SMART has anything to say.

What ZFS does when a read fails its checksum
  1. 1Read and verifyChecksum is stored in the parent block
  2. 2Checksum failsRead another copy or reconstruct from parity
  3. 3Confirm the resultThe new data must match the checksum
  4. 4Rewrite the bad sectorCounted in the CKSUM column of zpool status

That only works when ZFS controls the redundancy. A single-disk pool detects corruption but cannot fix it, unless you set copies=2 on the dataset. RAID-Z on top of a hardware RAID volume has the same limitation.

If you want checksums without ZFS on Linux, dm-integrity under mdadm can turn silent corruption into a read error that md then repairs. It works, with a real write cost, and I would only choose it over ZFS when something else rules ZFS out.

Scrubs

A scrub reads all allocated data and verifies it against checksums, repairing as it goes. Start one with zpool scrub tank and watch it with zpool status. Debian and Ubuntu packages include a monthly scrub job, but check that it is enabled on your system rather than assuming so.

An md check is also a full read, and it does fix read errors from redundancy. The difference is the disagreement case above, where md has no way to decide which data is right. A ZFS scrub also skips free space, so a pool that is 30% full scrubs only 30% of the capacity, where md reads every sector of every member regardless.

The same applies to rebuilds. Resilvering in ZFS copies only allocated blocks. On a 20 TB drive in a lightly filled pool, that can be a fraction of the time a full-disk md rebuild takes. On a nearly full, heavily fragmented pool, the advantage shrinks and a resilver can be slower than a sequential md rebuild, because allocated blocks are scattered and the drive spends time seeking.

RAID-Z vs mdadm vs hardware RAID

ZFS RAID-Zmdadm + XFS/ext4Hardware RAID
Detects silent corruptionYes, on every readNo, without dm-integrityNo, usually only parity mismatches
Picks the correct copyYesNoNo
Write holeNone, through copy-on-write and variable stripesYes, unless using journal or PPLHandled with battery- or flash-backed cache
Rebuild scopeAllocated dataWhole driveUsually whole drive
Add drives to a groupYes, 2.3+ (see below)Yes, with reshapeController dependent
Change parity levelNoYes, some conversionsController dependent
Remove a drive and shrinkNoPossible, with careRarely
Moving disks to a new serverAny machine with compatible ZFSAny Linux machineOften same vendor or family
Kernel integration on LinuxOut-of-tree moduleIn-treeVendor driver and tools

RAID-Z has a performance property worth knowing before you buy. A RAID-Z vdev writes each block as its own stripe across the vdev, so the random IOPS of the vdev behave roughly like those of one drive, however wide it is. Sequential throughput scales with the width. For a virtual machine host on hard drives, eight drives as four mirrors will far outrun an eight-drive RAID-Z2. The zpoolconcepts man page recommends 3 to 9 devices in a RAID-Z group for performance reasons, which means that for larger arrays you should build several vdevs in the same pool.

RAID-Z compared with mdadm and hardware RAID
Where it helps
  • Detects silent corruption on every read and picks the correct copy
  • No write hole, through copy-on-write and variable stripes
  • Rebuilds and scrubs touch only allocated data
  • Sequential throughput scales with the width of the vdev
What to know before you buy
  • Random IOPS of a vdev behave roughly like one drive
  • No change of parity level and no narrowing of a vdev
  • Adding a drive to a group needs OpenZFS 2.3 or newer
  • Out-of-tree kernel module on Linux

RAM myths

The "1 GB of RAM per TB of disk" rule is the one you will hear most, and it is folklore. It traces back to deduplication, whose table does consume memory in proportion to data, and it has been repeated about pools that do not use dedup at all. The OpenZFS FAQ suggests 8 GB or more for best performance, says 2 GB or less is possible, and says you need more if using deduplication. There is no per-terabyte rule. Size the RAM for your working set.

ZFS looks like it eats memory because the ARC read cache uses what is free. The current zfs(4) man page sets the default ARC ceiling at the larger of all RAM minus 1 GiB and 5/8 of RAM, and older Linux builds used lower limits. ARC gives memory back under pressure, but that is less instantaneous than the page cache, so on a server running a large database or VMs, cap it:

/etc/modprobe.d/zfs.conf
# /etc/modprobe.d/zfs.conf: limit ARC to 16 GiB
options zfs zfs_arc_max=17179869184

The FAQ says ECC is not strictly required, but is highly recommended, and strongly so for enterprise use. The reasoning in the hardware guide is straightforward: no filesystem technique can protect against a bit flip in RAM. If a flip occurs before ZFS computes the checksum, bad data gets a valid checksum, and if it occurs afterwards, the block may be detected as bad but not correctable.

The scary version says that a bad stick with ZFS will "scrub your pool to death" by miscorrecting good data. That story has been challenged a lot, because a block has to fail its checksum and then a replacement has to pass, and random memory errors do not produce valid checksums for wrong data. A faulty module will still cause real corruption on any filesystem, though ZFS at least tends to make the fault visible as a stream of checksum errors.

So non-ECC ZFS is no more dangerous than non-ECC ext4. For a production server, buy ECC either way. Note that DDR5's on-die ECC protects within the memory chip only and is not the same as a full ECC module with channel protection. To check what you actually have, run dmidecode -t 16 and read the Error Correction Type line.

Expansion limits: the current state of RAID-Z expansion

For years the top complaint about ZFS was that you could not add a disk to a RAID-Z vdev. That changed with OpenZFS 2.3.0, which added RAID-Z expansion. The mechanics are in the zpool-attach man page:

Add a drive to a RAID-Z2 vdev (OpenZFS 2.3+)
zpool attach tank raidz2-0 /dev/disk/by-id/ata-NEW_DRIVE
zpool status tank

Redundancy stays in place throughout, and if a drive fails mid-expansion the process pauses until the vdev is healthy again. It requires the raidz_expansion feature, so an older pool needs zpool upgrade first.

Check your distribution, because the package you get by default may predate this. At the time of writing, Ubuntu 24.04 ships 2.2.2 with no expansion, Debian 13 ships 2.3.2 with a newer version in backports, and Ubuntu 26.04 ships a 2.4 release. Run zfs version to see what you have.

The catch is that existing data is redistributed but its parity ratio does not change. Take six 20 TB drives in RAID-Z2 holding 60 TB, then attach a seventh:

Six to seven drives in RAID-Z2
Before: 4 data + 2 parity. 60 TB of data occupies 60 x 6/4 = 90 TB raw.
After:  raw capacity 140 TB, 90 TB still occupied, 50 TB free.
New writes at 5 data + 2 parity: 50 x 5/7 = about 35.7 TB more data.
Total usable: about 95.7 TB, against 100 TB for a fresh 7-wide RAID-Z2.

You recover the difference only by rewriting old blocks. The zfs rewrite command in current releases does that, per the zfs-rewrite man page, as long as it runs after the expansion finishes. Snapshots still hold the old blocks until they expire. Space reporting tools also continue to assume the old ratio, so zfs list understates free space somewhat.

Other limits remain. You cannot go from RAID-Z1 to RAID-Z2, and expansion does not change the failure tolerance. You cannot narrow a RAID-Z vdev.

mdadm is still more flexible here. mdadm --grow can change the device count and convert between some levels, at the cost of a long reshape with the array under load.

Creating a pool

This syntax applies to OpenZFS 2.2 and newer. On Ubuntu, install with apt install zfsutils-linux. On Debian 13, enable the contrib component, then run apt install linux-headers-amd64 zfs-dkms zfsutils-linux. Always use /dev/disk/by-id paths, because sdX names can change between boots.

Create a pool (OpenZFS 2.2 and newer)
# RAID-Z2 with six drives
zpool create -o ashift=12 \
  -O compression=lz4 -O atime=off -O xattr=sa -O acltype=posixacl \
  tank raidz2 \
  /dev/disk/by-id/ata-DRIVE1 /dev/disk/by-id/ata-DRIVE2 \
  /dev/disk/by-id/ata-DRIVE3 /dev/disk/by-id/ata-DRIVE4 \
  /dev/disk/by-id/ata-DRIVE5 /dev/disk/by-id/ata-DRIVE6

# Striped mirrors for VMs or databases
zpool create -o ashift=12 -O compression=lz4 -O atime=off vmpool \
  mirror /dev/disk/by-id/nvme-A /dev/disk/by-id/nvme-B \
  mirror /dev/disk/by-id/nvme-C /dev/disk/by-id/nvme-D

# Datasets tuned per workload
zfs create -o recordsize=1M tank/media
zfs create -o recordsize=16K vmpool/mysql

ashift can only be set when a device is added, and a wrong value is permanent for that vdev. Set ashift=12 explicitly for 4K drives, since some drives report 512-byte sectors in emulation.

When each one wins

ZFS wins for bulk storage, backups, media archives and any data you would be upset to lose quietly. Snapshots and zfs send replication alone justify it for many setups. Our storage servers come with root access and IPMI, so you can install it directly.

mdadm with XFS or ext4 wins for a simple two-drive OS volume, for latency-sensitive databases on NVMe if your benchmarks support it, and wherever you do not want an out-of-tree kernel module. ZFS is not in the mainline Linux kernel because of its license, so a kernel upgrade can leave you waiting on a compatible module. That is manageable, but it does mean testing updates before a reboot.

Hardware RAID wins in fewer places than it used to: Windows hosts, some hypervisor setups, and environments with existing controller tooling and spares on hand. If you do use it, buy a flash-backed cache, keep a spare controller and test the monitoring.