Software RAID (Redundant Array of Independent Disks) is a critical data protection mechanism that combines multiple physical disk drives into a single logical unit for improved performance, redundancy, or both. Unlike hardware RAID controllers that require dedicated cards, software RAID is implemented by the operating system — making it free, flexible, and easier to manage. In this guide, we compare the three primary Linux software RAID approaches: mdadm, Btrfs RAID, and ZFS RAID (RAID-Z).

mdadm: The Linux Standard for Software RAID

mdadm (Multiple Device Admin) is the traditional Linux software RAID tool, built into the kernel via the MD (Multiple Device) driver. It has been the standard for Linux software RAID since the early 2000s and supports all RAID levels (0, 1, 4, 5, 6, 10).

mdadm operates at the block device level, creating virtual block devices (/dev/mdX) that the kernel treats like physical disks. This means any filesystem (ext4, XFS, Btrfs) can be placed on top of an mdadm array.

Key features include:

  • All standard RAID levels: RAID 0 (striping), RAID 1 (mirroring), RAID 5/6 (parity), RAID 10 (striped mirrors)
  • Hot spare support: Automatic rebuild on drive failure using designated spare disks
  • Write-intent bitmap: Speeds up resync operations after unclean shutdowns
  • Incremental assembly: Automatic array detection and assembly at boot
  • Monitor mode: Built-in daemon for email alerts on RAID events
  • Grow and reshape: Online RAID level migration and array expansion

mdadm is the most mature and widely-tested option, making it the default choice for production Linux servers requiring block-level RAID.

Btrfs RAID: Integrated Filesystem RAID

Btrfs (B-tree filesystem) includes native RAID functionality built directly into the filesystem layer. Unlike mdadm, which creates block devices, Btrfs RAID is managed as part of the filesystem itself.

Btrfs supports RAID 0, RAID 1, RAID 10, and RAID 5/6 (the latter still considered experimental). Its key differentiator is integrated volume management — you add and remove devices directly from the filesystem without a separate RAID layer.

Key features include:

  • Integrated volume management: No separate RAID layer; devices are managed by the filesystem
  • Copy-on-write: Atomic writes with built-in checksums for data and metadata
  • Online device management: Add, remove, and replace devices while the filesystem is mounted
  • Automatic scrubbing: Background data integrity verification
  • Snapshot support: Read-only and read-write snapshots for point-in-time recovery
  • Transparent compression: Built-in zlib, lzo, and zstd compression

Btrfs RAID is attractive for users who want a unified storage solution without managing separate RAID and filesystem layers.

ZFS RAID (RAID-Z): Enterprise-Grade Storage

ZFS (Zettabyte File System) combines volume management, software RAID, and filesystem features into a single integrated stack. Originally developed by Sun Microsystems, OpenZFS is the open-source implementation available on Linux.

ZFS uses RAID-Z (its equivalent of RAID 5/6) and traditional mirroring within storage pools called zpools. Unlike mdadm or Btrfs, ZFS treats the entire storage pool as a single managed entity.

Key features include:

  • RAID-Z1/2/3: Single, double, and triple parity protection
  • End-to-end checksums: Automatic detection and correction of silent data corruption
  • Self-healing: Automatic repair using parity or mirror copies
  • Adaptive replacement cache (ARC): Intelligent RAM-based caching
  • Compression: Transparent lz4, gzip, and zstd compression with significant space savings
  • Scrubbing: Online integrity checking that repairs corruption automatically
  • Resilvering: Intelligent rebuild that only copies used data, not entire disks

ZFS is the most feature-rich option, offering enterprise-level data integrity and management capabilities.

Feature Comparison Table

FeaturemdadmBtrfs RAIDZFS RAID (RAID-Z)
RAID Levels0, 1, 4, 5, 6, 100, 1, 10, 5/6 (exp)0, 1, mirror, RAID-Z1/2/3
LayerBlock deviceFilesystemIntegrated pool+filesystem
Data ChecksumsNoYes (data + metadata)Yes (data + metadata)
Self-HealingNoYes (with checksums)Yes (automatic)
Hot SparesYesYesYes
Online ExpansionYes (grow)Yes (device add)Yes (vdev add/replace)
Snapshot SupportNo (needs LVM)Yes (native)Yes (native)
CompressionNo (filesystem level)Yes (native)Yes (native)
ScrubbingNoYesYes
Memory RequirementsLowModerateHigh (ARC cache)
MaturityVery High (20+ years)Moderate (RAID 5/6 exp)High (15+ years)
Best ForTraditional RAIDIntegrated storageEnterprise data integrity

Installation and Configuration

mdadm Setup

Install mdadm and create a RAID 5 array:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Install mdadm
apt-get install mdadm -y

# Create RAID 5 array with 4 disks (1 parity)
mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde

# Format with ext4
mkfs.ext4 /dev/md0

# Mount the array
mkdir -p /mnt/raid5
mount /dev/md0 /mnt/raid5

# Save array configuration
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
update-initramfs -u

Monitor array status:

1
2
3
4
5
6
# Check array status
cat /proc/mdstat
mdadm --detail /dev/md0

# Monitor in real-time
watch cat /proc/mdstat

Btrfs RAID Setup

Create a Btrfs filesystem with RAID 1 across two devices:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Install Btrfs tools
apt-get install btrfs-progs -y

# Create Btrfs filesystem with RAID 1 for data and metadata
mkfs.btrfs -d raid1 -m raid1 /dev/sdb /dev/sdc

# Mount the filesystem
mkdir -p /mnt/btrfs-raid
mount /dev/sdb /mnt/btrfs-raid

# Check filesystem status
btrfs filesystem show /mnt/btrfs-raid
btrfs filesystem usage /mnt/btrfs-raid

Add a device to an existing Btrfs RAID:

1
2
3
4
5
# Add a third device
btrfs device add /dev/sdd /mnt/btrfs-raid

# Rebalance to redistribute data across all devices
btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/btrfs-raid

ZFS RAID-Z Setup

Create a ZFS storage pool with RAID-Z1 (single parity):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Install ZFS
apt-get install zfsutils-linux -y

# Create RAID-Z1 pool with 4 disks
zpool create tank raidz1 /dev/sdb /dev/sdc /dev/sdd /dev/sde

# Check pool status
zpool status tank
zpool list tank

# Create a dataset with compression
zfs create tank/data
zfs set compression=lz4 tank/data

# Mount (automatic)
ls /tank/data

Scrub the pool for integrity verification:

1
2
3
4
5
# Start a scrub
zpool scrub tank

# Check scrub progress
zpool status tank

Choosing the Right RAID Solution

Choose mdadm if:

  • You need proven, battle-tested block-level RAID
  • You want to use any filesystem on top of the RAID array
  • You have limited RAM (mdadm has minimal memory overhead)
  • You need RAID 5/6 with mature, well-understood behavior

Choose Btrfs RAID if:

  • You want integrated volume management and filesystem features
  • Copy-on-write semantics and snapshots are important
  • You are comfortable with experimental RAID 5/6 or only need RAID 1/10
  • You want a single-layer solution without managing separate RAID and filesystem

Choose ZFS RAID if:

  • Data integrity is your top priority (end-to-end checksums, self-healing)
  • You need enterprise features like ARC caching and intelligent resilvering
  • You have sufficient RAM (8GB+ recommended for ZFS ARC)
  • You want integrated snapshots, compression, and deduplication

For organizations also managing storage replication across sites, our DRBD vs ZFS Georeplication vs GlusterFS guide covers complementary disaster recovery options. For NAS solutions that leverage these RAID technologies, our OpenMediaVault vs TrueNAS vs Rockstor comparison shows how RAID integrates into complete storage platforms.

Why Self-Host Software RAID?

Complete data control is the primary advantage of self-hosted RAID. When you manage your own RAID infrastructure, you decide the redundancy level, rebuild policies, and monitoring thresholds. Cloud-based storage solutions abstract these decisions away, often with hidden costs and vendor-specific implementations.

Cost efficiency is substantial for large storage deployments. Hardware RAID controllers cost $200-$2,000+ per server, and managed storage services charge premium rates for redundancy. Software RAID provides equivalent (or superior) protection at zero additional hardware cost.

Flexibility in hardware selection means you can mix drive sizes, brands, and interfaces within the same array (with some limitations). Hardware RAID controllers often require matched drives and specific backplane configurations.

Faster rebuild times are possible with software RAID because the OS has direct access to all drives without going through a RAID controller bottleneck. ZFS intelligent resilvering further reduces rebuild time by only copying active data.

Transparent migration between RAID levels is possible with mdadm (online reshape) and Btrfs (online device add/remove), allowing you to adapt your storage configuration as requirements change without downtime.

FAQ

Which RAID level should I choose for home servers?

For home servers with 2+ drives, RAID 1 (mirroring) provides the best balance of protection and simplicity. For 3+ drives, RAID 5 (single parity) offers good capacity efficiency with protection against a single drive failure. For critical data with 4+ drives, RAID 6 (dual parity) protects against two simultaneous drive failures.

Can I mix different drive sizes in a software RAID array?

With mdadm, all drives in a RAID 5/6 array should be the same size — the array uses the smallest drive’s capacity for all members. With Btrfs and ZFS, you can mix drive sizes, but usable capacity is constrained by the smallest drive in each RAID group. ZFS vdevs work best with matched drives.

How long does a RAID rebuild take?

Rebuild time depends on array size, RAID level, and system load. A typical 4TB RAID 5 rebuild takes 4-8 hours on modern hardware. RAID 6 rebuilds take longer due to dual parity calculations. ZFS resilvering is typically faster because it only copies active data, not entire disk capacity.

Is Btrfs RAID 5/6 production-ready?

Btrfs RAID 5/6 is still considered experimental and has known issues with power loss and parity calculation bugs. The Btrfs community recommends using RAID 1 or RAID 10 for production workloads. For RAID 5/6 on Linux, mdadm or ZFS are more reliable choices.

How do I monitor my software RAID arrays?

For mdadm, use mdadm --monitor as a daemon to receive email alerts on array events. For Btrfs, use btrfs scrub start for regular integrity checks and btrfs device stats for error monitoring. For ZFS, configure zpool scrub on a schedule and use zpool status for health checks. Many monitoring tools (Prometheus exporters, Netdata) also support RAID health metrics.

Can I convert between RAID types without losing data?

mdadm supports online RAID level conversion (e.g., RAID 1 to RAID 5) using mdadm --grow --level=5 --raid-devices=4. Btrfs allows online device addition and profile conversion using btrfs balance. ZFS supports adding vdevs to pools but cannot change existing vdev RAID levels — you would need to create a new pool and migrate data.