NetBSD GSoC 2026 Improving RAIDframe
NetBSD GSoC 2026: Enhancing the RAIDframe Framework
Date: August 23, 2026
Author: Emmanuel Nyarko
Posted by: Leonardo Taccari
This report summarizes the contributions made by Emmanuel Nyarko during the Google Summer of Code 2026 program, focusing on the evolution of NetBSD's disk management.
📌 Overview of RAIDframe
The Redundant Array of Independent Disks (RAID) is a sophisticated disk management architecture originally conceived at Carnegie-Mellon University. NetBSD incorporates this via RAIDframe, a module that allows administrators to aggregate multiple physical disks into a single logical disk unit.
While the current framework supports various disk arrangement levels (as detailed in raid(4)), several bottlenecks existed:
RAID 1 Limitation:Mirroring was restricted to exactly two disks per pair.- Missing Scrubbing: There was no native support for "scrubbing" (the process of proactively reading disks to detect and fix read failures).
- Unstable RAID 6: Although the code exists in the source tree, RAID 6 was largely untested and not recommended for production.
Project Goal: To expand the capabilities of RAIDframe by implementing N-way RAID 1 and introducing a disk scrubbing mechanism to ensure higher data integrity.
🛠️ Implementation: N-way RAID 1
What is N-way RAID 1?
Standard RAID 1 involves mirroring data across two disks: one primary and one secondary (parity). In this setup, every write operation is mirrored to all active disks. Reads are optimized by selecting the disk with the shortest I/O queue. If a disk fails, the system enters degraded mode, retrieving data from any surviving member.
N-way RAID 1 extends this logic. Instead of a simple pair, it allows for one primary disk and multiple secondary disks.
This architecture significantly boosts redundancy. For instance, in a 5-way RAID 1 configuration, you have one primary and four secondary disks, drastically reducing the probability of total data loss.
Configuration and Usage
To establish a 5-way RAID 1 array using raidctl(8), the following command is used:
raidctl /dev/raid1 create N /dev/dk1 /dev/dk2 /dev/dk3 /dev/dk4 /dev/dk5
Parameter Breakdown:
/dev/raid1: The target device file.N: The RAID level./dev/dk*: The NetBSD disk partition (wedge) drivers (refer todk(4)anddkctl(8)).
Note: The first disk listed is designated as the primary; all subsequent disks are secondary.
Default Settings
By default, the system applies:
- Stripe Unit: 128 sectors.
- Queuing: First-In-First-Out (FIFO).
- Max Queue Length: 100.
This configuration can be represented in a raid.conf file as follows:
# numrow numcol numspare
1 5 0
# Identify physical disks
START disks
/dev/dk1
/dev/dk2
/dev/dk3
/dev/dk4
/dev/dk5
# Layout: 128 sectors per stripe unit
START layout
# Sect/StripeUnit StripeUnit/ParityUnit StripeUnit/#ReconUnit RaidLevel
128 1 1 N
# No spares configured
START spare
START queue
fifo 100
⚙️ Technical Deliverables
1. RAIDframe Layout
A specialized layout structure was developed for RAID level N. Since the stripe-related properties of RAID 1 were already sufficient, they were adopted and integrated into the RAID N logic.
2. Sector/Stripe Mapping
RAIDframe utilizes Address Stripe Mapping (ASM), which employs Physical Disk Addresses (PDAs) to translate software addresses into physical locations.
| PDA Field | Description |
|---|---|
| Column Number | The index of the disk in the array |
| Start Sector | The beginning physical sector |
| Sector Count | Number of blocks/sectors involved |
| Disk Type | Classification (Data vs. Parity) |
| Buffer Pointer | Pointer to the data buffer |
| Virtual Address | The corresponding RAID virtual address |
In a standard 2-disk RAID 1, the number of PDAs is static. However, for N-way RAID 1, the number of PDAs is determined dynamically at runtime based on the number of parity columns provided.
3. DAG Execution
RAIDframe manages I/O operations using Directed Acyclic Graphs (DAGs). The node creation logic was updated to ensure the DAG can trigger I/O for more than two PDAs when operating under RAID level N.
4. Reconstruction Logic
The reconstruction process was modified to support RAID N. To prevent erratic I/O patterns across the array, the updated algorithm:
- Identifies a single healthy (non-dead) disk.
- Reads data exclusively from that one disk.
- Writes the data to the disk currently under reconstruction.
📈 Project Benefits & Future Work
The primary advantage of this project is the massive increase in data redundancy, which minimizes the risk of catastrophic loss during multiple disk failures.
RAIDframe Scrubbing
The project also introduced scrubbing, which acts as a comprehensive health check. This involves:
- Reading every sector across every stripe in the array.
- Verifying the integrity of the data.
- Identifying latent read failures before they cause a crash.