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

RAID bitmap usage

Use write-intent bitmaps to reduce full-sync times after unexpected system shutdowns.

In this lesson, you will learn how to use a write-intent bitmap to ensure that your RAID array recovers quickly and efficiently after an unexpected power loss or system crash.

The Problem with Full Resyncs

When a RAID array (created with mdadm) is shut down improperly—such as during a power outage or a kernel panic—the system loses track of which data blocks were "in flight" at the moment of the crash. By default, the RAID controller assumes the entire array might be inconsistent. Upon reboot, it performs a full resynchronization, reading every single block on the drive to recalculate parity or mirror status. On large modern drives, this process can take many hours or even days, during which your array's performance is significantly degraded.

Enter the Write-Intent Bitmap

A write-intent bitmap is a small file or memory-resident map that tracks which regions of the RAID array have pending writes. When the system writes data to the array, it marks the corresponding "bit" in the bitmap. If the system crashes, the bitmap is preserved.

Upon rebooting, mdadm checks the bitmap instead of scanning the entire disk. It only needs to resynchronize the small sections marked as "dirty," reducing a potential multi-hour rebuild to a process that takes only a few seconds or minutes.

Enabling a Bitmap

You can add a write-intent bitmap to an existing RAID array (assuming it is mdadm-based) using the --grow command. To add an internal bitmap, use the following syntax:

# Add a write-intent bitmap to an existing array
sudo mdadm --grow /dev/md0 --bitmap=internal

Once enabled, the kernel keeps the bitmap updated in real-time. You don’t need to manage it manually; the RAID subsystem handles the marking and clearing of these bits automatically during normal operation.

While the bitmap consumes a tiny amount of disk space and a negligible amount of I/O overhead to update, the trade-off is almost always worth it for data availability and system recovery speed.

Key Takeaway: A write-intent bitmap prevents lengthy full-array resynchronizations after a crash by tracking only the specific segments that need verification, significantly speeding up the recovery process.