When dealing with "flipping bits" (bit rot, phantom writes, or silent data corruption), ZFS is generally considered the gold standard and holds distinct advantages over BTRFS. ZFS treats data integrity as a fundamental rule, offering more comprehensive mechanisms to prevent, detect, and fix these issues.
1. In-band "Self-Healing"
2. Full-Tree Metadata Redundancy
3. Separation of Data and Checksums
4. Parity-RAID Reliability
1. In-band "Self-Healing"
- ZFS: Actively cross-references data with metadata checksums in real-time. If a flipped bit is detected during a read in a redundant pool (Mirror or RAID-Z), ZFS instantly reads the correct parity/mirror block, repairs the damaged sector, and returns the correct data to the application without any interruption.
- BTRFS: While BTRFS can detect flipped bits using checksums, it relies heavily on manual administrative intervention to resolve them. You generally have to trigger a btrfs scrub to identify errors and—if you have a RAID1/10 setup—repair them, meaning the data isn't instantaneously "self-healed" on the fly.
2. Full-Tree Metadata Redundancy
- ZFS: Utilizes a Merkle tree structure. Every block of data has its own checksum. ZFS actively stores multiple copies of its metadata spread across different physical areas of your disks. If a localized hardware failure or flipped bit wipes out one set of metadata, ZFS has backup metadata readily available.
- BTRFS: BTRFS relies on a CRC32C checksum and primarily stores only two copies of its metadata tree on disk, which are not widely distributed. In scenarios involving severe localized disk degradation or bad sectors, BTRFS metadata can be more easily compromised, which can occasionally force the system into a read-only state.
3. Separation of Data and Checksums
- ZFS: Checksums are stored in the parent block pointer rather than alongside the data payload itself. This architecture inherently protects against phantom writes (where a drive controller reports a write was successful, but the data was never actually recorded or was recorded in the wrong place). ZFS detects this immediately because the parent block pointer will physically not point to the actual data location.
- BTRFS: Stores checksums in the metadata blocks. While it provides good protection against standard bit flips, it can sometimes be vulnerable to severe storage controller faults or phantom writes, leading to complex metadata inconsistency.
4. Parity-RAID Reliability
- ZFS: RAID-Z (ZFS's equivalent to RAID 5/6) calculates parity alongside continuous checksum validation, effectively eliminating traditional RAID "write holes" and making it vastly more reliable for large volume arrays where bit flips can occur during rebuilds.
- BTRFS: BTRFS is highly flexible, but its native RAID 5 and RAID 6 equivalents are notoriously unstable and carry known data loss risks in certain failure and write scenarios. For BTRFS, you are generally restricted to safer RAID 1 or 10 configurations to comfortably protect against bit rot.