The write hole represents a critical data integrity issue in RAID systems where a power failure during write operations leaves disks in an inconsistent state. This occurs when:
- Data blocks get written but corresponding parity updates remain incomplete (RAID 5/6)
- Mirror writes fail to complete on all disks (RAID 1)
- Partial stripe writes occur without proper synchronization
Primary affected levels:
RAID 5 - Single parity writes vulnerable
RAID 6 - Double parity writes vulnerable
RAID 1 - Mirror inconsistency possible
Unaffected levels:
RAID 0 - No redundancy means no write hole
RAID 10 - Complete stripe writes prevent holes
RAID-Z - Uses copy-on-write to avoid issue
Different RAID implementations handle the write hole differently:
Hardware RAID controllers:
Many enterprise-grade controllers include battery-backed cache (BBWC) or flash-backed cache (FBWC) to prevent write holes by ensuring transaction completion.
Software RAID (mdadm):
Linux mdadm has implemented journaling since kernel 3.5+ to address write holes:
# Create RAID5 array with journal
mdadm --create /dev/md0 --level=5 --raid-devices=3 \
--write-journal /dev/sdd1 /dev/sda1 /dev/sdb1 /dev/sdc1
Write holes typically manifest during:
- Array resynchronization (cat /proc/mdstat)
- Scrubbing operations (mdadm --action=check /dev/md0)
- Disk replacement/recovery scenarios
For existing systems:
# Enable write-intent bitmap (mdadm)
mdadm --grow --bitmap=internal /dev/md0
# Force regular consistency checks
echo check > /sys/block/md0/md/sync_action
For new deployments:
Consider ZFS or btrfs with built-in copy-on-write protection, or hardware controllers with power loss protection.
Journaling solutions typically incur 5-15% write performance overhead. Battery-backed cache solutions add hardware cost but maintain performance.
The RAID write hole represents a critical data consistency issue that occurs when power failure interrupts write operations. This problem manifests differently across RAID implementations:
// Potential write hole scenario in RAID 5
1. System receives write request for blocks A, B, C
2. Writes new data to disks 1, 2, 3
3. Power failure occurs before parity P is updated
4. Result: Inconsistent parity-state across the array
Contrary to some documentation, the write hole impacts multiple RAID configurations:
- RAID 5/6: Most vulnerable due to separate data and parity writes
- RAID 1: When mirroring operations are interrupted mid-write
- RAID 10: Subset of mirrors may become inconsistent
The write hole manifests differently between hardware and software RAID:
# mdadm (Linux software RAID) protection example
echo 10000 > /sys/block/md0/md/sync_speed_max
echo check >> /sys/block/md0/md/sync_action
RAIDZ avoids write holes through:
- Copy-on-write transactional model
- Atomic parity updates
- End-to-end checksums
# Creating a RAIDZ pool example
zpool create tank raidz1 sda sdb sdc
zpool set autoexpand=on tank
For traditional RAID implementations:
- Use battery-backed write cache (BBWC)
- Implement journaling filesystems
- Regular array scrubbing
// Periodic scrub scheduling with cron
0 3 * * 0 /usr/sbin/raid-check --auto-repair
Enterprise RAID controllers typically include:
- Non-volatile cache memory
- Strict write ordering
- Emergency power-off protection