# Bit Rot: What It Is and How ZFS and Btrfs Catch It

Title: Bit Rot: What It Is and How ZFS and Btrfs Catch It
Canonical URL: https://www.mrplanb.com/blog/bit-rot
Published: 2026-11-28
Author: Mr.PlanB
Language: en

Bit rot is the gradual, silent corruption of stored data caused by an accumulation of non-critical failures in a storage device, even when files sit untouched. In a homelab, checksumming filesystems such as ZFS and Btrfs detect bit rot by verifying block checksums during scheduled scrubs and automatically repairing damaged blocks from healthy mirror or parity replicas.

## What is bit rot and does it really happen?

Per [Wikipedia's Data degradation article](https://en.wikipedia.org/wiki/Data_degradation), bit rot (also known as data degradation, data decay, or digital decay) is the gradual decline in data quality over time due to non-critical device failures. It can be triggered by physical media decay, software errors, security breaches, human error, obsolete technology, or unauthorized access.

Bit rot happens more often as storage grows. As disk capacities, file sizes, and the volume of stored data increase, the likelihood of uncorrected and undetected data corruption rises as well. Low-level disk controllers use error correction codes (ECC) to fix routine read errors, and dynamic random-access memory (DRAM) can suffer soft errors when electric charges disperse or when cosmic rays and high-energy particles flip a bit. Using [ECC memory on a Proxmox host](https://www.mrplanb.com/blog/ecc-vs-non-ecc-ram-proxmox) helps mitigate those DRAM soft errors before data ever reaches disk.

Even a tiny change can visibly break a file. The Wikipedia article shows this with a 326,272-bit JPEG photo: flipping 1, 2, or 3 bits alters decoding coefficients and introduces noticeable visual artifacts across the image. On Linux, running `cmp -b` against a known good copy reveals the exact binary difference.

## How bit rot affects SSDs, HDDs, tape, and optical media

Each kind of storage medium decays in its own way.

On solid-state media such as SSDs, EPROMs, SD cards, USB sticks, and M.2 NVMe drives, data is stored as electrical charges. Imperfect insulation allows those charges to leak away slowly over time. Modern flash controllers compensate by testing lower threshold voltages until ECC passes, and reprogramming the chip roughly once per decade prevents decay as long as an undamaged, checksum-verified master copy exists. Because typical SD cards, USB sticks, and M.2 NVMe drives have limited endurance, the same article says refresh cycles should be no longer than 6 months to keep NAND devices legible.

On magnetic media such as hard disk drives (HDDs), floppy disks, and magnetic tape, bits can lose their magnetic orientation over time. Higher temperatures accelerate magnetic loss, though modern hard drives using Giant magnetoresistance have magnetic lifespans on the order of decades and rewrite ECC-corrected errors automatically. Floppy disks and magnetic tapes are poorly protected against ambient air and face physical decomposition in warm or humid rooms.

On optical media such as CD-R, DVD-R, and BD-R, both the dye and the reflective backing layer can break down. Early cyanine-based CD-R dyes lacked UV stability, and early CDs suffered from CD bronzing caused by bad lacquer and failing aluminum layers. Storing optical discs in a dark, cool, low-humidity location slows decay, and data integrity scanning can predict degradation ahead of uncorrectable loss.

## How ZFS and Btrfs detect and repair bit rot

Most filesystems trust the disk controller to return valid data. Checksumming filesystems verify every block themselves, and with redundancy they repair silent errors on their own.

| Filesystem | How it detects | How it repairs | Command |
| :--- | :--- | :--- | :--- |
| ZFS | Verifies every block checksum against stored metadata | Copies good data from `mirror`, `raidz`, or `draid` replicas | `zpool scrub <pool>` |
| Btrfs | Checks data checksums, super blocks, metadata headers, and read errors | Copies verified data from replicated profiles (such as RAID1) | `btrfs scrub start <path>` |

Per the [OpenZFS zpool-scrub manual](https://openzfs.github.io/openzfs-docs/man/master/8/zpool-scrub.8.html), running `zpool scrub` examines all data in a pool and verifies each block's checksum. Unlike resilvering, which only checks data known to be out of date when you attach or replace a drive, scrubbing reads every block to uncover silent hardware faults. On replicated pools (`mirror`, `raidz`, or `draid`), ZFS repairs any damaged block automatically and reports progress and repaired bytes in `zpool status` (with `zpool status -v` listing any unrepairable files when encryption keys are loaded). For encrypted datasets, a thorough scrub (`zpool scrub -t`) also decrypts and decompresses blocks to catch rare cases where a checksum matches while decryption or decompression fails. If you are building a new pool, see our [ZFS configuration guide](https://www.mrplanb.com/blog/zfs-configuration-guide) and [ZFS storage overview](https://www.mrplanb.com/storage/zfs).

Per the [Btrfs Scrub documentation](https://btrfs.readthedocs.io/en/latest/Scrub.html), `btrfs scrub start` runs a validation pass over all filesystem data and metadata to catch data checksum errors, basic super block errors, basic metadata block header errors, and disk read errors. On replicated block group profiles such as RAID1, a read-write scrub repairs damage automatically from another replica, and Btrfs also repairs errors on normal reads when mounted read-write.

One Btrfs detail is easy to miss. Setting the `NOCOW` attribute (`chattr +C`) implicitly enables `NODATASUM`, which disables data checksums while leaving metadata checksummed. Both `systemd` (on journals) and `libvirt` version 6.6 and newer (on storage pool directories) set `+C` by default, so Btrfs cannot tell which mirror holds uncorrupted data for those files. A Btrfs scrub is not a full filesystem checker like `btrfs-check(8)`; it only validates checksums and copies from good replicas.

## How often should you scrub ZFS and Btrfs?

Scrubs only catch silent corruption if they run on a schedule.

For ZFS, the OpenZFS `zpool-scrub` manual includes systemd timer units for automated scheduling on a per-pool basis: `zfs-scrub-weekly@rpool.timer` for weekly checks and `zfs-scrub-monthly@otherpool.timer` for monthly checks. Because scrubbing and resilvering are I/O-intensive, ZFS only runs one at a time, and pausing a scrub with `zpool scrub -p` checkpoints progress to disk so you can resume later.

For Btrfs, the Btrfs Scrub documentation recommends a monthly scrub period, or more frequently if needed. On an idle filesystem, a Btrfs scrub uses about 80% of device bandwidth, with status updated every 5 seconds in `/var/lib/btrfs/`. On Linux 5.14 and newer, you can cap bandwidth per device using `/sys/fs/btrfs/FSID/devinfo/DEVID/scrub_speed_max` or inspect limits with `btrfs scrub limit`. On Linux 6.19 and newer, if suspend, hibernation, or cgroup freezing interrupts a scrub, you can continue from the last saved position with `btrfs scrub resume`.

## Does RAID or a backup protect against bit rot?

Hardware or software RAID without block-level checksums can mirror or stripe corrupted data without knowing which disk is wrong. Wikipedia's article makes the point that storage systems need integrity checking alongside redundancy so they can audit data and recover from a verified copy. Comparing [ZFS, Ceph, LVM-Thin, and traditional RAID](https://www.mrplanb.com/blog/proxmox-storage-zfs-vs-ceph-vs-lvm-thin-vs-raid) makes that trade-off clear: ZFS combines checksums with `mirror`, `raidz`, or `draid` parity so it can tell which replica is damaged.

Backups alone have the same blind spot. Replicating data as backups only protects against data degradation when both the original and backed-up copies are audited by checksumming or comparing against other replicas. Without verification, a scheduled backup job copies a silently corrupted file over your last clean copy. Keeping replicas across multiple autonomous sites with varied hardware and software improves resilience against media failure, human error, and cyberattacks. Pairing local scrubs with [offsite backups](https://www.mrplanb.com/storage/offsite-backup) closes that gap.

## Practical checklist to prevent bit rot in your homelab

For a TrueNAS, Proxmox, Unraid or Linux NAS setup:

- Choose a checksumming filesystem with redundancy, such as a ZFS `mirror`, `raidz`, or `draid` pool or Btrfs with a replicated profile like RAID1, and avoid `NOCOW` on directories that hold important data.
- Schedule regular scrubs using ZFS weekly or monthly systemd timers, or a monthly Btrfs scrub, and check `zpool status` or `/var/lib/btrfs/` for repaired or unrepairable errors.
- Use ECC memory when your motherboard and CPU support it to reduce DRAM soft errors before writes hit disk.
- Verify backups with checksums or replica comparisons rather than assuming copied files are healthy.
- Follow the [3-2-1 backup rule](https://www.mrplanb.com/storage/3-2-1-backup-rule) with at least one verified offsite copy on independent hardware.

## FAQ

### What is bit rot in simple terms?

Per Wikipedia's Data degradation article, bit rot is the gradual corruption of stored computer data caused by accumulated non-critical failures in a storage device, lowering data quality over time even when files are not accessed.

### Does bit rot happen on SSDs and NVMe drives?

Yes. Per Wikipedia's Data degradation article, flash memory in SSDs, SD cards, USB sticks, and M.2 NVMe drives stores data as electrical charges that slowly leak through imperfect insulation, requiring controller ECC and periodic refresh cycles.

### Does RAID protect against bit rot?

Redundancy alone only helps when paired with integrity checking. Checksumming filesystems like ZFS and Btrfs use replicated layouts such as mirrors or RAIDZ to detect mismatched checksums and automatically repair damaged blocks from a verified replica.

### How often should I run a ZFS scrub or Btrfs scrub?

Per the OpenZFS documentation, systemd timers support weekly or monthly scrubs per pool. Per the Btrfs documentation, the recommended scrub period is once a month or more frequently depending on your workload.

### Why do backups alone fail to stop bit rot?

Without checksum verification or comparison against another copy, latent faults go unnoticed until you read the file. An unverified backup simply copies the silently corrupted file to your backup target.

Source: https://www.mrplanb.com/blog/bit-rot
