Course contentsShow
← Linux
Lesson 701 of 1,8197. Storage Management and Logical VolumesFree lesson

RAID consistency checks

Schedule regular scrubbing to detect and correct bit rot on degraded arrays.

In this lesson, you will learn how to schedule regular RAID scrubbing to protect your data integrity against silent corruption, often called "bit rot."

The Problem: Silent Corruption

Even if your hard drives haven't physically failed, the data stored on them can slowly degrade over time. Bits can flip due to electromagnetic interference or physical aging, leading to silent data corruption. Because a standard RAID array only knows if a drive has "failed" (stopped responding), it won't notice if the data inside a file has silently changed.

What is a "Scrub"?

A "scrub" (or consistency check) is a proactive process where the RAID controller reads every block of data on all disks in the array. It compares the data on your primary drives against their parity blocks (or mirrors). If the system detects a mismatch between these, it identifies the inconsistency and automatically overwrites the corrupt data with the correct version calculated from the parity, effectively "healing" the array.

Automating the Check

On most modern Linux distributions, mdadm handles this through a system-wide script, usually located at /etc/cron.d/mdcheck_start or via a systemd timer. You can manually trigger a check to ensure it works on your array (replace /dev/md0 with your array name) by writing check to the sync_action file:

echo check > /sys/block/md0/md/sync_action

You can monitor the progress of this operation by watching the mdstat file:

cat /proc/mdstat

Why Regular Scheduling Matters

If you wait until a drive physically fails to perform a check, you might discover that your parity data is stale or corrupted, leading to data loss during the rebuild. By scheduling a scrub—typically once a month—you ensure that the RAID array is constantly validating its own health. This is especially critical for degraded arrays, as it ensures that the remaining healthy drives are truly consistent before you attempt to integrate a replacement disk.

Key Takeaway: Regularly scheduling RAID scrubs is the only way to detect and fix silent bit rot before it compromises your entire array's integrity.