Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux

RAID 0 (Stripe) stands for Redundant Array of Inexpensive Disks. It is a data storage technique that combines multiple disks into a single logical unit to provide improved performance and storage capacity. RAID 0 uses striping to write data across multiple disks simultaneously, offering faster data access but no redundancy.

In this article, we will learn how to create RAID 0 on two devices using the mdadm tool in Linux.

What is RAID 0?

RAID 0, also known as striping, divides data into blocks and writes them across all disks in the array. This allows for faster data access and transfer speeds since multiple disks can be read from or written to simultaneously. However, RAID 0 provides no redundancy ? if one disk fails, all data is lost.

RAID 0 Data Striping Data Block A1 A2 A3 A4 Disk 1 A1 A3 Disk 2 A2 A4 /dev/sdb /dev/sdc Data blocks are alternately written to both disks

RAID 0 is commonly used in applications requiring high performance, such as video editing, gaming, and database operations where speed is prioritized over data protection.

Prerequisites

Before creating RAID 0, ensure you have

  • Two disks of similar size and speed (e.g., /dev/sdb, /dev/sdc)

  • Linux system with root access

  • mdadm tool installed

Step-by-Step RAID 0 Creation

Step 1: Identify Available Disks

First, identify the disks you want to use for RAID 0

sudo fdisk -l

Look for your target disks (e.g., /dev/sdb and /dev/sdc). Ensure they are not mounted and contain no important data.

Step 2: Install mdadm Tool

Install the mdadm package if not already available

sudo apt-get install mdadm

Step 3: Create RAID 0 Array

Create the RAID 0 array using two devices

sudo mdadm --create /dev/md0 --level=stripe --raid-devices=2 /dev/sdb /dev/sdc

This command creates a RAID 0 array named /dev/md0 using striping across two devices.

Step 4: Format the RAID Array

Format the RAID 0 array with ext4 filesystem

sudo mkfs.ext4 /dev/md0

Step 5: Create Mount Point and Mount Array

Create a mount point and mount the RAID array

sudo mkdir /mnt/raid0
sudo mount /dev/md0 /mnt/raid0

Step 6: Configure Auto-Assembly

Save the RAID configuration for automatic assembly on boot

sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

Step 7: Configure Auto-Mount

Add an entry to /etc/fstab for automatic mounting

echo "/dev/md0 /mnt/raid0 ext4 defaults 0 0" | sudo tee -a /etc/fstab

Testing and Verification

Create Test File

Test the RAID array by creating a test file

sudo dd if=/dev/zero of=/mnt/raid0/testfile bs=1M count=100

Check RAID Status

Verify the RAID array status and configuration

sudo mdadm --detail /dev/md0

This displays detailed information including RAID level, device count, and status of each disk.

Monitoring RAID Array

Monitor the RAID array health using

sudo mdadm --monitor --scan --test --oneshot

Set up regular monitoring to detect disk failures early and prevent data loss.

RAID 0 Characteristics

Aspect RAID 0 Single Disk
Performance 2x read/write speed Standard speed
Capacity Sum of all disks Single disk capacity
Redundancy None None
Failure Risk Higher (any disk failure = total loss) Single point of failure

Best Practices

  • Use identical disks Same size, speed, and model for optimal performance

  • Regular backups Essential since RAID 0 offers no data protection

  • Monitor disk health Use SMART monitoring tools to detect early failure signs

  • Suitable applications Best for temporary files, caching, and performance-critical non-critical data

Conclusion

RAID 0 provides excellent performance by striping data across multiple disks, doubling read/write speeds. However, it offers no redundancy, making regular backups crucial. It's ideal for applications requiring high performance where data can be easily recreated or restored from backups.

Updated on: 2026-03-17T09:01:38+05:30

961 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements