Skip to main content

Command Palette

Search for a command to run...

πŸ›‘οΈπŸ›‘οΈ RAID-6 Double Protection: Complete Hands-On Guide

Published
β€’27 min read
πŸ›‘οΈπŸ›‘οΈ RAID-6 Double Protection: Complete Hands-On Guide

Learn RAID-6 setup, dual-failure recovery, and enterprise-grade management β€” explained like you're talking to a friend


🎯 What You'll Master Today

By the end of this guide, you'll be able to:

  • βœ… Understand RAID-6 deeply (the upgrade from RAID-5)

  • βœ… Build a production-ready RAID-6 array

  • βœ… Handle TWO simultaneous disk failures like a pro

  • βœ… Monitor and maintain your array

  • βœ… Clean up safely without breaking your system

Difficulty: Beginner-friendly (we explain everything)
Lab environment: Virtual machine recommended


For a detailed understanding of each RAID level, please refer to my comprehensive article, RAID for Linux Admins (The Ultimate Intro Guide), available at the link below.

RAID for Linux Admins (The Ultimate Intro Guide)

⚠️ CRITICAL WARNING - Read This First!

🚨 THIS TUTORIAL WILL DESTROY DATA ON THE DISKS YOU USE! 🚨

Before starting:

  1. Never use your system disk (where your operating system lives)

  2. Use virtual disks (VirtualBox, VMware, KVM) OR spare physical disks

  3. Backup everything if you're unsure which disk is which

  4. Double-check with lsblk before every command

# Always verify your disks first!
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

If you see your operating system mounted on a disk β€” DO NOT USE THAT DISK!


πŸ’‘ RAID-6 Explained (The Simple Truth)

What is RAID-6?

RAID-6 is the safer big brother of RAID-5. It's the same concept, but with an important upgrade:

RAID-5: Can lose 1 disk and survive
RAID-6: Can lose 2 disks and survive ← This is huge!

Why RAID-6 exists (The Real-World Problem)

Imagine this nightmare scenario:

  1. You have RAID-5 with 4TB disks

  2. One disk fails β†’ You start rebuilding

  3. Rebuild takes 12 hours (large disks = slow rebuild)

  4. During rebuild, another disk fails

  5. πŸ’€ ALL DATA IS GONE

RAID-6 solves this! Even if 2 disks fail, your data is safe.

How does it actually work? (The Easy Way)

Imagine you have 4 notebooks (disks):

Example - Storing the number "6":

Notebook ANotebook BNotebook CNotebook D
Stores: 2Stores: 4Stores: Parity PStores: Parity Q

Now if you lose BOTH Notebook A and B:

  • You still have C (Parity P) and D (Parity Q)

  • The TWO parity systems can recreate A (2) AND B (4)

  • So you get your original number 6!

In RAID-6:

  • Your files are broken into pieces

  • Pieces are spread across all disks

  • TWO different parity calculations are stored

  • If ANY two disks die, parity helps rebuild both

Simple Benefits:

What You GetWhy It's Good
Faster readingMultiple disks read at once
TWO disks can failMuch safer than RAID-5!
More storage4 disks of 2GB each = 4GB usable (not 2GB)
Safer rebuildsA second failure during rebuild doesn't kill you

Simple Math:

4 disks Γ— 2GB = 8GB total
RAID-6 uses 2 disks worth for parity = 4GB
You get to use = 4GB

Formula: (Number of disks - 2) Γ— Size of one disk

The Important Catch:

⚠️ If 3 disks fail at the same time = ALL DATA IS LOST

Why? Because two parity systems can only rebuild TWO missing disks, not three.

RAID-5 vs RAID-6 Comparison:

FeatureRAID-5RAID-6
Minimum disks34
Disk failures tolerated12
Parity overhead1 disk2 disks
Write speedGoodSlower (double parity)
Read speedGoodGood
Rebuild riskHighLow
Best forHome/small officeEnterprise/critical data

When to use RAID-6:

βœ… Good for:

  • Enterprise file servers

  • Large disk arrays (1TB+ disks)

  • Critical data storage

  • When rebuild time is long (hours or days)

  • 24/7 production systems

  • When you need peace of mind

❌ Not good for:

  • Very small arrays (only 3 disks available)

  • When maximum write speed is critical

  • Budget-constrained setups (uses 2 disks for parity)

Remember: RAID is NOT a backup! If your building floods, all disks are gone. Always backup important data separately.


πŸ” Step 1: Find Your Practice Disks

Let's see what disks we have available. RAID-6 needs at least 4 disks.

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Example output:

root@rhel:~# lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
NAME             SIZE TYPE MOUNTPOINT
sda                2G disk 
sdb                2G disk 
sdc                2G disk 
sdd                2G disk 
sde                2G disk 
sdf                2G disk

What we'll use:

  • /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd β†’ Build RAID-6 (4 disks)

  • /dev/sde, /dev/sdf β†’ Spare disks (for dual-failure simulation later)

Don't have these? If you're in a VM, add 6 new virtual disks (2GB each) through your hypervisor settings

Step 1.1: Remove old metadata using (wipefs)

Before setting up the RAID-6 array, we need to ensure the disks are clean of any previous filesystem, RAID, or partition-table signatures. This prevents conflicts that could stop the RAID creation process.

The wipefs command erases these signatures (often called "magic strings") from the specified devices.

sudo wipefs -a /dev/sda
sudo wipefs -a /dev/sdb
sudo wipefs -a /dev/sdc
sudo wipefs -a /dev/sdd
sudo wipefs -a /dev/sde
sudo wipefs -a /dev/sdf

#OR
sudo wipefs -a /dev/sd{a,b,c,d,e,f}

πŸ”§ Step 2: Prepare Disks with Partitions

Each disk needs one partition. We'll use fdisk because it's straightforward.

Create partition on first disk:

sudo fdisk /dev/sda

Now type these commands inside fdisk:

n         ← Create new partition
p         ← Make it primary
1         ← Partition number 1
[Enter]   ← Accept default start
[Enter]   ← Accept default end (use whole disk)
t         ← Change partition type
fd        ← Set to "Linux RAID autodetect"
w         ← Write changes and exit

Repeat for ALL disks:

sudo fdisk /dev/sdb  # Repeat same steps
sudo fdisk /dev/sdc  # Repeat same steps
sudo fdisk /dev/sdd  # Repeat same steps
sudo fdisk /dev/sde  # Repeat same steps (spare disk #1)
sudo fdisk /dev/sdf  # Repeat same steps (spare disk #2)

Output:
Here is the output of one all other are same.

root@rhel:~# sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.40.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0xf64402e4.

Command (m for help): n 
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-4194303, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-4194303, default 4194303): 

Created a new partition 1 of type 'Linux' and of size 2 GiB.

Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

πŸ’‘ Pro tip: The fd type tells Linux "this is a RAID disk". Modern Linux can work without it, but using fd is best practice.

Verify your work:

lsblk -o NAME,SIZE,TYPE

Expected result:

root@rhel:~# partprobe /dev/sd{a,b,c,d,e,f}
root@rhel:~# lsblk -o NAME,SIZE,TYPE
NAME             SIZE TYPE
sda                2G disk
└─sda1             2G part
sdb                2G disk
└─sdb1             2G part
sdc                2G disk
└─sdc1             2G part
sdd                2G disk
└─sdd1             2G part
sde                2G disk
└─sde1             2G part
sdf                2G disk
└─sdf1             2G part

Update partition table:

fdisk /dev/sd{a,b,c,d,e,f}

πŸ“¦ Step 3: Install RAID Management Tool

mdadm (Multiple Device Administrator) is the Linux tool for managing RAID.

On Debian/Ubuntu:

sudo apt update
sudo apt install mdadm -y

On RHEL/CentOS/Rocky/AlmaLinux:

sudo dnf install mdadm -y

Verify installation:

mdadm --version

πŸ—οΈ Step 4: Build Your RAID-6 Array

Time to create the actual RAID! This combines four disks into one logical device.

sudo mdadm --create --verbose /dev/md0 \
  --level=6 \
  --raid-devices=4 \
  /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

#OR use can use command with chunk size 
sudo mdadm --create --verbose /dev/md0 \
  --level=6 \
  --raid-devices=4 \
  --chunk=256K \
  /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

Command breakdown:

PartWhat It Does
--createTell mdadm to make a new array
--verboseShow detailed progress
/dev/md0Name of the new RAID device
--level=6Use RAID-6 (TWO disk parity)
--raid-devices=4How many disks in the array
/dev/sda1 ... /dev/sdd1The four partitions to use
--chunk=256kThe chunk size (also called β€œstripe unit size”) is the amount of data written to each disk in the array before moving to the next disk.

You might see a warning: "Continue creating array?" β†’ Type y and press Enter.

Output:

root@rhel:~# sudo mdadm --create --verbose /dev/md0 \
  --level=6 \
  --raid-devices=4 \
  /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 2094080K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

Watch it build:

cat /proc/mdstat

You'll see:

md0 : active raid6 sdd1[3] sdc1[2] sdb1[1] sda1[0]
      4190208 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/4] [UUUU]
      [===>.................]  resync = 18.7% (392704/2095104) finish=0.7min

What this means:

  • [UUUU] = All 4 disks are healthy (U = Up)

  • level 6 = Confirms this is RAID-6

  • resync = 18.7% = Initial parity calculation in progress

  • Wait for this to complete (usually 1-3 minutes for small disks)

When done, you'll see:

root@rhel:~# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid6 sdd1[3] sdc1[2] sdb1[1] sda1[0]
      4188160 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/4] [UUUU]

unused devices: <none>

No more resync line = Ready to use! βœ“


πŸ’Ύ Step 5: Make It Permanent (Survive Reboots)

Right now, if you reboot, Linux will forget about your RAID. Let's fix that.

On Debian/Ubuntu:

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

On RHEL/CentOS/Rocky/AlmaLinux:

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

What this command does:

  1. --detail --scan = Look at all RAID arrays and get their info

  2. tee -a = Add (append) that info to the config file

  3. Config file = Where Linux remembers RAID settings

Output:

root@rhel:~# sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf
ARRAY /dev/md0 metadata=1.2 UUID=689ed52a:791c601a:a6f339d6:e598945e
root@rhel:~#

Update boot system:

On Debian/Ubuntu:

sudo update-initramfs -u

On RHEL/CentOS/Rocky/AlmaLinux:

sudo dracut --force

What this does: Updates the boot system so RAID starts automatically when computer turns on.


πŸ“‚ Step 6: Create Filesystem & Mount It

Now we'll format the RAID and make it usable for storing files.

Format with ext4:

sudo mkfs.ext4 -L ENTERPRISE_RAID6 /dev/md0

Command breakdown:

PartMeaning
mkfs.ext4Make filesystem - ext4 type (standard Linux)
-L ENTERPRISE_RAID6Give it a friendly name (label)
/dev/md0Format the RAID device

πŸ’‘ Why give it a label? Makes it easier to identify and mount later.

Output:

root@rhel:~# sudo dracut --force
root@rhel:~# sudo mkfs.ext4 -L ENTERPRISE_RAID6 /dev/md0
mke2fs 1.47.1 (20-May-2024)
Creating filesystem with 1047040 4k blocks and 262144 inodes
Filesystem UUID: 3823c970-f9b8-4e44-998c-1c90d4e59664
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

Create mount point and mount:

sudo mkdir -p /mnt/raid6
sudo mount /dev/md0 /mnt/raid6

Output:

root@rhel:~# sudo mkdir -p /mnt/raid6
root@rhel:~# sudo mount /dev/md0 /mnt/raid6
root@rhel:~#

What happened:

  • Created folder /mnt/raid6 (mount point)

  • Connected RAID device to that folder

  • Now you can use /mnt/raid6 to save files!

Verify it's working:

df -hT | grep raid6
#OR 
df -hT /mnt/raid6

Output:

root@rhel:~# df -hT | grep raid6
/dev/md0              ext4      3.9G   24K  3.7G   1% /mnt/raid6
root@rhel:~# df -hT /mnt/raid6/
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/md0       ext4  3.9G   24K  3.7G   1% /mnt/raid6
root@rhel:~#

Reading this:

  • ext4 = filesystem type

  • 4.0G = total space available (2 disks worth lost to dual parity)

  • 1% = only 1% used (almost empty)

πŸŽ‰ Success! You now have a working RAID-6 array with ~4GB usable space.


πŸ” Step 7: Inspect Your RAID Array

Let's look under the hood.

sudo mdadm --detail /dev/md0

You'll see something like:

root@rhel:~# sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Oct 22 06:03:22 2025
        Raid Level : raid6
        Array Size : 4188160 (3.99 GiB 4.29 GB)
     Used Dev Size : 2094080 (2045.00 MiB 2144.34 MB)
      Raid Devices : 4
     Total Devices : 4
       Persistence : Superblock is persistent

       Update Time : Wed Oct 22 06:11:03 2025
             State : clean 
    Active Devices : 4
   Working Devices : 4
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 512K

Consistency Policy : resync

              Name : rhel:0  (local to host rhel)
              UUID : 689ed52a:791c601a:a6f339d6:e598945e
            Events : 17

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
       3       8       49        3      active sync   /dev/sdd1
root@rhel:~#

Key things to watch:

  • Raid Level: raid6 = Confirms double parity protection

  • State: clean = Everything is perfect

  • Failed Devices: 0 = No problems

  • All disks show "active sync" = All healthy and working

Check the label:

sudo e2label /dev/md0

Output: ENTERPRISE_RAID6 βœ“


πŸ§ͺ Step 8: Test It With Real Data

Let's make sure it actually works by creating some files.

# Create a test file
echo "RAID-6 double protection is working!" | sudo tee /mnt/raid6/test.txt

# Create a larger file (20MB)
sudo dd if=/dev/zero of=/mnt/raid6/bigfile.dat bs=1M count=20

# Create a directory with multiple files
sudo mkdir /mnt/raid6/important_data
echo "Document 1" | sudo tee /mnt/raid6/important_data/doc1.txt
echo "Document 2" | sudo tee /mnt/raid6/important_data/doc2.txt

# List what's there
ls -lhR /mnt/raid6/

You should see:

root@rhel:~# echo "RAID-6 double protection is working!" | sudo tee /mnt/raid6/test.txt
RAID-6 double protection is working!
root@rhel:~# sudo dd if=/dev/zero of=/mnt/raid6/bigfile.dat bs=1M count=20
20+0 records in
20+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.0404265 s, 519 MB/s
root@rhel:~# sudo mkdir /mnt/raid6/important_data
root@rhel:~# echo "Document 1" | sudo tee /mnt/raid6/important_data/doc1.txt
Document 1
root@rhel:~# echo "Document 2" | sudo tee /mnt/raid6/important_data/doc2.txt
Document 2
root@rhel:~# ls -lhR /mnt/raid6/
/mnt/raid6/:
total 21M
-rw-r--r--. 1 root root  20M Oct 22 06:15 bigfile.dat
drwxr-xr-x. 2 root root 4.0K Oct 22 06:16 important_data
drwx------. 2 root root  16K Oct 22 06:09 lost+found
-rw-r--r--. 1 root root   37 Oct 22 06:15 test.txt

/mnt/raid6/important_data:
total 8.0K
-rw-r--r--. 1 root root 11 Oct 22 06:15 doc1.txt
-rw-r--r--. 1 root root 11 Oct 22 06:16 doc2.txt

/mnt/raid6/lost+found:
total 0
root@rhel:~#

Perfect! Data is safely stored on your RAID!


πŸ’₯ Step 9: Simulate FIRST Disk Failure

This is where RAID-6 shows its basic protection. Let's pretend /dev/sdb1 dies.

Mark first disk as failed:

sudo mdadm --manage /dev/md0 --fail /dev/sdb1

Output: mdadm: set /dev/sdb1 faulty in /dev/md0

What we did: Told the RAID system "pretend this disk is broken"

Check what happened:

sudo mdadm --detail /dev/md0

Now you'll see:

 root@rhel:~# sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Oct 22 06:03:22 2025
        Raid Level : raid6
        Array Size : 4188160 (3.99 GiB 4.29 GB)
     Used Dev Size : 2094080 (2045.00 MiB 2144.34 MB)
      Raid Devices : 4
     Total Devices : 4
       Persistence : Superblock is persistent

       Update Time : Wed Oct 22 06:17:38 2025
             State : clean, degraded 
    Active Devices : 3
   Working Devices : 3
    Failed Devices : 1
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 512K

Consistency Policy : resync

              Name : rhel:0  (local to host rhel)
              UUID : 689ed52a:791c601a:a6f339d6:e598945e
            Events : 19

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       -       0        0        1      removed
       2       8       33        2      active sync   /dev/sdc1
       3       8       49        3      active sync   /dev/sdd1

       1       8       17        -      faulty   /dev/sdb1
root@rhel:~#

Understanding "degraded":

  • Your RAID still works normally

  • Data is fully accessible

  • You can still lose ONE MORE disk safely

  • If you lost two more disks now = data is gone

Test if data is still accessible:

cat /mnt/raid6/test.txt
ls /mnt/raid6/important_data/

Output:

root@rhel:~# cat /mnt/raid6/test.txt
RAID-6 double protection is working!
root@rhel:~# ls /mnt/raid6/important_data/
doc1.txt  doc2.txt
root@rhel:~#

πŸŽ‰ Your data survived the first disk failure!


πŸ’₯πŸ’₯ Step 10: Simulate SECOND Disk Failure (The Big Test!)

This is what makes RAID-6 special! Let's fail a SECOND disk while first one is still failed.

Mark second disk as failed:

sudo mdadm --manage /dev/md0 --fail /dev/sdc1

Output: mdadm: set /dev/sdc1 faulty in /dev/md0

Check the critical status:

sudo mdadm --detail /dev/md0

Now you'll see:

root@rhel:~# sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Oct 22 06:03:22 2025
        Raid Level : raid6
        Array Size : 4188160 (3.99 GiB 4.29 GB)
     Used Dev Size : 2094080 (2045.00 MiB 2144.34 MB)
      Raid Devices : 4
     Total Devices : 4
       Persistence : Superblock is persistent

       Update Time : Wed Oct 22 06:20:23 2025
             State : clean, degraded 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 2
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 512K

Consistency Policy : resync

              Name : rhel:0  (local to host rhel)
              UUID : 689ed52a:791c601a:a6f339d6:e598945e
            Events : 25

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       -       0        0        1      removed
       -       0        0        2      removed
       3       8       49        3      active sync   /dev/sdd1

       1       8       17        -      faulty   /dev/sdb1
       2       8       33        -      faulty   /dev/sdc1

Critical situation:

  • Array is running on MINIMUM capacity (2 disks)

  • ONE MORE failure = total data loss

  • But data is STILL ACCESSIBLE!

Test if data STILL works:

cat /mnt/raid6/test.txt
cat /mnt/raid6/important_data/doc1.txt
cat /mnt/raid6/important_data/doc2.txt
ls -lh /mnt/raid6/

Output:

root@rhel:~# cat /mnt/raid6/test.txt
RAID-6 double protection is working!
root@rhel:~# cat /mnt/raid6/important_data/doc1.txt
Document 1
root@rhel:~# cat /mnt/raid6/important_data/doc2.txt
Document 2
root@rhel:~# ls -lh /mnt/raid6/
total 21M
-rw-r--r--. 1 root root  20M Oct 22 06:15 bigfile.dat
drwxr-xr-x. 2 root root 4.0K Oct 22 06:16 important_data
drwx------. 2 root root  16K Oct 22 06:09 lost+found
-rw-r--r--. 1 root root   37 Oct 22 06:15 test.txt
root@rhel:~# ^C

EVERYTHING STILL WORKS!

🎊 THIS IS THE MAGIC OF RAID-6! Two disks died, but your data is completely safe and accessible!

In RAID-5: You'd have lost everything when the second disk failed.

Remove both failed disks:

sudo mdadm --manage /dev/md0 --remove /dev/sdb1
sudo mdadm --manage /dev/md0 --remove /dev/sdc1

Output:

mdadm: hot removed /dev/sdb1 from /dev/md0
mdadm: hot removed /dev/sdc1 from /dev/md0

Important: You can only remove a disk AFTER marking it as faulty.


πŸ”§ Step 11: Rebuild With TWO New Disks

Now we'll replace BOTH dead disks with our spare /dev/sde1 and /dev/sdf1.

In real life, this is when you'd physically replace two broken disks with new ones.

Add the first replacement disk:

sudo mdadm --manage /dev/md0 --add /dev/sde1

Output: mdadm: added /dev/sde1

Watch the first rebuild start:

cat /proc/mdstat

You'll see:

root@rhel:~# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid6 sde1[4] sdd1[3] sda1[0]
      4188160 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/2] [U__U]
      [=============>.......]  recovery = 68.2% (1430568/2094080) finish=0.0min speed=204366K/sec

What this means:

  • [U__U] = Two disks working (U), two rebuilding (the __ underscores)

  • First disk (sde1) is being rebuilt

  • RAID-6 rebuilds ONE disk at a time for stability

Wait a moment, then add the second replacement:

sudo mdadm --manage /dev/md0 --add /dev/sdf1

Output: mdadm: added /dev/sdf1

Watch BOTH disks rebuild:

watch -n 2 cat /proc/mdstat

You'll see the first disk complete, then the second starts:

root@rhel:~# watch -n 2 cat /proc/mdstat
md0 : active raid6 sdf1[5] sde1[4] sdd1[3] sda1[0]
      4190208 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [UU_U]
      [======>...............]  recovery = 31.2% finish=1.2min speed=42000K/sec

What's happening:

  • RAID-6 uses dual parity to recreate ALL data on BOTH new disks

  • First disk rebuilds completely

  • Then second disk rebuilds

  • This ensures data integrity

In real life: With large disks (4TB+), this takes MANY hours or even days!

Wait for both to complete. Press Ctrl+C to stop watching when done.

Verify rebuild success:

sudo mdadm --detail /dev/md0

You should see:

root@rhel:~# sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Oct 22 06:03:22 2025
        Raid Level : raid6
        Array Size : 4188160 (3.99 GiB 4.29 GB)
     Used Dev Size : 2094080 (2045.00 MiB 2144.34 MB)
      Raid Devices : 4
     Total Devices : 4
       Persistence : Superblock is persistent

       Update Time : Wed Oct 22 06:26:08 2025
             State : clean 
    Active Devices : 4
   Working Devices : 4
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 512K

Consistency Policy : resync

              Name : rhel:0  (local to host rhel)
              UUID : 689ed52a:791c601a:a6f339d6:e598945e
            Events : 71

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       4       8       65        1      active sync   /dev/sde1
       5       8       81        2      active sync   /dev/sdf1
       3       8       49        3      active sync   /dev/sdd1
root@rhel:~#

Notice: /dev/sde1 and /dev/sdf1 replaced the failed disks in positions 1 and 2.

Confirm ALL data is still intact:

cat /mnt/raid6/test.txt
cat /mnt/raid6/important_data/doc1.txt
ls -lhR /mnt/raid6/

Output:

root@rhel:~# cat /mnt/raid6/test.txt
RAID-6 double protection is working!
root@rhel:~# cat /mnt/raid6/important_data/doc1.txt
Document 1
root@rhel:~# ls -lhR /mnt/raid6/
/mnt/raid6/:
total 21M
-rw-r--r--. 1 root root  20M Oct 22 06:15 bigfile.dat
drwxr-xr-x. 2 root root 4.0K Oct 22 06:16 important_data
drwx------. 2 root root  16K Oct 22 06:09 lost+found
-rw-r--r--. 1 root root   37 Oct 22 06:15 test.txt

/mnt/raid6/important_data:
total 8.0K
-rw-r--r--. 1 root root 11 Oct 22 06:15 doc1.txt
-rw-r--r--. 1 root root 11 Oct 22 06:16 doc2.txt

/mnt/raid6/lost+found:
total 0
root@rhel:~#

All files are there!

🎊 PERFECT! You just recovered from TWO disk failures like an enterprise system administrator!


πŸ… Step 12: The Ultimate Test - Fail TWO Disks Simultaneously

Let's prove RAID-6 can handle two disks failing at the EXACT same time.

Reset by failing and removing current "new" disks:

# Fail both at once
sudo mdadm --manage /dev/md0 --fail /dev/sde1 --fail /dev/sdf1

# Remove them
sudo mdadm --manage /dev/md0 --remove /dev/sde1
sudo mdadm --manage /dev/md0 --remove /dev/sdf1

Verify data STILL works:

cat /mnt/raid6/test.txt

Output:

root@rhel:~# cat /mnt/raid6/test.txt
RAID-6 double protection is working!
root@rhel:~#

Still works! πŸŽ‰

Add them back and rebuild:

sudo mdadm --manage /dev/md0 --add /dev/sde1 --add /dev/sdf1

Watch the magic happen again:

watch -n 2 cat /proc/mdstat
root@rhel:~# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid6 sdf1[5] sde1[4] sdd1[3] sda1[0]
      4188160 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/4] [UUUU]

unused devices: <none>
root@rhel:~#

πŸ“Š Step 13: Real-World Monitoring

In production systems, you need to know when disks fail BEFORE you lose data.

Check RAID health regularly:

# Quick status check
cat /proc/mdstat

# Detailed health report
sudo mdadm --detail /dev/md0

# Check all RAID arrays
sudo mdadm --detail --scan

Set up a cron job to check daily:(you can skip this step for this tutorial) (but in real env cron job is best choice)

# Edit crontab
sudo crontab -e

# Add this line (checks every day at 2 AM)
0 2 * * * /usr/sbin/mdadm --detail --scan > /var/log/raid-check.log 2>&1

Check disk health with SMART: (For physical disks not for virtual disks)

# Install smartmontools if not already installed
sudo apt install smartmontools -y  # Debian/Ubuntu
sudo dnf install smartmontools -y  # RHEL/CentOS

# Check individual disk health
sudo smartctl -a /dev/sda
sudo smartctl -a /dev/sdb
sudo smartctl -a /dev/sdc
sudo smartctl -a /dev/sdd

Look for:

  • SMART Health Status: OK = Good

  • Reallocated_Sector_Ct = Should be 0 or very low

  • Current_Pending_Sector = Should be 0

  • Offline_Uncorrectable = Should be 0

For virtual disks

Since SMART doesn’t work on virtual drives, you can:

  • Monitor the host’s physical disks (from the hypervisor, not the VM).

  • Use software-level checks inside the VM:

        sudo badblocks -sv /dev/sda
        sudo badblocks -sv /dev/sdb
        sudo badblocks -sv /dev/sdc
        sudo badblocks -sv /dev/sdd
    

    or file-system checks (fsck), if you want to detect logical corruption.

Output of just /dev/sda:

root@rhel:~# sudo badblocks -sv /dev/sda
Checking blocks 0 to 2097151
Checking for bad blocks (read-only test): done                                                 
Pass completed, 0 bad blocks found. (0/0/0 errors)
root@rhel:~#

(0/0/0 errors) means no error.


🏁 Step 14: Make It Auto-Mount on Boot

Right now, you must manually mount after each reboot. Let's make it automatic.

Get the UUID:

sudo blkid /dev/md0

Output:

root@rhel:~# sudo blkid /dev/md0
/dev/md0: LABEL="ENTERPRISE_RAID6" UUID="3823c970-f9b8-4e44-998c-1c90d4e59664" BLOCK_SIZE="4096" TYPE="ext4"
root@rhel:~#

What is UUID? A unique ID for this filesystem. It never changes, even if device names change.

Copy the UUID value (the part between quotes after UUID=).

Edit fstab:

sudo nano /etc/fstab

Add this line at the bottom (replace UUID with yours):

UUID=3823c970-f9b8-4e44-998c-1c90d4e59664 /mnt/raid6  ext4  defaults,nofail  0  2

What each part means:

PartMeaning
UUID=...Identifies the RAID filesystem
/mnt/raid6Where to mount it
ext4Filesystem type
defaultsUse standard mount settings
nofailDon't stop boot if RAID fails to mount
0Don't backup with dump
2Check filesystem at boot (after root filesystem)

Why nofail is CRITICAL for RAID-6: If RAID is degraded or rebuilding during boot, system will still boot (not hang).

Save and exit (Ctrl+X, then Y, then Enter).

Test it works:

# Unmount
sudo umount /mnt/raid6

# Try auto-mounting from fstab
sudo mount -a

# Verify
df -h | grep raid6

If you see it mounted, perfect! βœ“

Now RAID will automatically mount every time you boot.


🧹 Step 15: Complete Cleanup (When Done Testing)

Let's remove everything cleanly to avoid problems later.

1️⃣ Unmount the filesystem:

sudo umount /mnt/raid6

Troubleshooting: If you get "device is busy":

# Find what's using it
sudo lsof | grep /mnt/raid6

# Or check if you're inside that directory
pwd  # If you're in /mnt/raid6, type: cd ~

# Force unmount if really needed (be careful!)
sudo umount -l /mnt/raid6

2️⃣ Stop the RAID array:

sudo mdadm --stop /dev/md0

Output: mdadm: stopped /dev/md0

3️⃣ Verify it's stopped:

cat /proc/mdstat

You should see: No md0 listed (maybe just Personalities : [raid6]).

4️⃣ Erase RAID metadata (CRITICAL STEP):

sudo mdadm --zero-superblock /dev/sda1
sudo mdadm --zero-superblock /dev/sdb1
sudo mdadm --zero-superblock /dev/sdc1
sudo mdadm --zero-superblock /dev/sdd1
sudo mdadm --zero-superblock /dev/sde1
sudo mdadm --zero-superblock /dev/sdf1

What this does: Removes RAID information from disks.

Why this is critical: Without this, Linux might try to auto-start the RAID on next boot, causing confusion or errors.

5️⃣ Delete partitions (optional - only if reusing disks):

sudo fdisk /dev/sda
# Type: d (delete partition), then w (write and exit)

sudo fdisk /dev/sdb
# Type: d, then w

sudo fdisk /dev/sdc
# Type: d, then w

sudo fdisk /dev/sdd
# Type: d, then w

sudo fdisk /dev/sde
# Type: d, then w

sudo fdisk /dev/sdf
# Type: d, then w

Wipe old RAID data and signatures:

# Wipe old RAID data and signatures
sudo wipefs -a /dev/sda
sudo wipefs -a /dev/sdb
sudo wipefs -a /dev/sdc
sudo wipefs -a /dev/sdd
sudo wipefs -a /dev/sde
sudo wipefs -a /dev/sdf

Update partition table:

partprobe /dev/sd{a,b,c,d,e,f}

6️⃣ Remove from config files:

On Debian/Ubuntu:

sudo nano /etc/mdadm/mdadm.conf
# Delete the line starting with "ARRAY /dev/md0 metadata=1.2 UUID=8ce9bb29:0baa7cbb:1f2aace8:5b96327f
"
# Save and exit

On RHEL/CentOS:

sudo nano /etc/mdadm.conf
# Delete the line starting with "ARRAY /dev/md0 metadata=1.2 UUID=8ce9bb29:0baa7cbb:1f2aace8:5b96327f
"
# Save and exit

Remove from fstab:

sudo nano /etc/fstab
# Delete the line with UUID and /mnt/raid6
# Save and exit

Update boot system:

# Debian/Ubuntu
sudo update-initramfs -u

# RHEL/CentOS
sudo dracut --force

7️⃣ Remove mount directory:

Copy

sudo rm -rf /mnt/raid6

8️⃣ Final verification:

# Should show nothing about md0
cat /proc/mdstat
ls /dev/md* 2>/dev/null
lsblk | grep md

πŸŽ‰ System is completely clean! You can now safely reboot or repurpose the disks.


πŸ†˜ Troubleshooting Common Problems

Here are solutions to common issues you might encounter while setting up or managing your RAID-6 array.

Problem: "Device or resource busy" when unmounting

Why this happens: Something (a program, terminal, or process) is still using the RAID mount point.

Solution:

# Find what's using it
sudo lsof | grep /mnt/raid6

# Make sure you're not inside the directory
pwd
cd ~  # Go to home directory

# Try unmounting again
sudo umount /mnt/raid6

# If still stuck, force it (last resort)
sudo umount -l /mnt/raid6

Warning: Use -l (lazy unmount) only if absolutely necessary, as it may leave processes in an inconsistent state.

Problem: RAID doesn't start after reboot

Why this happens:

  • RAID configuration wasn't saved to the config file.

  • Boot system wasn't updated properly.

Solution:

# Re-scan and save configuration
# For Debian/Ubuntu:
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

# For RHEL/CentOS/Rocky/AlmaLinux:
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf

# Update boot system
sudo update-initramfs -u  # Debian/Ubuntu
sudo dracut --force       # RHEL/CentOS/Rocky/AlmaLinux

Problem: Can't create RAID - "device has existing RAID data"

Why this happens: Disks still have old RAID metadata or filesystem signatures.

Solution:

# Wipe old RAID data and signatures
sudo wipefs -a /dev/sda
sudo wipefs -a /dev/sdb
sudo wipefs -a /dev/sdc
sudo wipefs -a /dev/sdd
sudo wipefs -a /dev/sde
sudo wipefs -a /dev/sdf

# Also clear RAID superblocks
sudo mdadm --zero-superblock /dev/sda1
sudo mdadm --zero-superblock /dev/sdb1
sudo mdadm --zero-superblock /dev/sdc1
sudo mdadm --zero-superblock /dev/sdd1
sudo mdadm --zero-superblock /dev/sde1
sudo mdadm --zero-superblock /dev/sdf1

# Then create RAID again
sudo mdadm --create --verbose /dev/md0 --level=6 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

Problem: RAID shows "inactive" after reboot

Why this happens: The RAID array didn't auto-assemble during boot.

Solution:

# Manually assemble it
sudo mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

# Then fix config so it auto-starts next time
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo update-initramfs -u  # Debian/Ubuntu
sudo dracut --force       # RHEL/CentOS/Rocky/AlmaLinux

Problem: Rebuild is taking forever

Why this happens: Rebuilding large disks (e.g., 4TB+) can take hours or days, which is normal for RAID-6 due to dual parity calculations.

What you can do:

# Check rebuild progress
cat /proc/mdstat

# Check current rebuild speed limits
cat /proc/sys/dev/raid/speed_limit_min
cat /proc/sys/dev/raid/speed_limit_max

# Increase rebuild speed (if system is not busy)
echo 50000 | sudo tee /proc/sys/dev/raid/speed_limit_min
echo 200000 | sudo tee /proc/sys/dev/raid/speed_limit_max

Note: Increasing rebuild speed increases system load. Avoid this on busy production servers to prevent performance degradation.


πŸ“š Quick Reference Commands

Here’s a handy list of commands for managing your RAID-6 array.

Daily Operations:

# Check RAID health (quick)
cat /proc/mdstat

# Check RAID health (detailed)
sudo mdadm --detail /dev/md0

# Check disk space
df -h /mnt/raid6

# Check all RAID arrays
sudo mdadm --detail --scan

# Check physical disk health
sudo smartctl -a /dev/sda

Emergency Commands:

# Mark disk as failed
sudo mdadm --manage /dev/md0 --fail /dev/sdb1

# Remove failed disk
sudo mdadm --manage /dev/md0 --remove /dev/sdb1

# Add replacement disk
sudo mdadm --manage /dev/md0 --add /dev/sde1

# Force assemble (if RAID won't start)
sudo mdadm --assemble --force /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

# Stop RAID
sudo mdadm --stop /dev/md0

# Clean RAID metadata
sudo mdadm --zero-superblock /dev/sda1

πŸŽ“ What You've Mastered

βœ… Understanding: You know exactly what RAID-6 is, how it uses dual parity for extra protection, and why it’s safer than RAID-5.

βœ… Building: You can create a RAID-6 array from scratch with full confidence.

βœ… Monitoring: You can check RAID health and disk status to detect and prevent early issues.

βœ… Recovery: You can handle two simultaneous disk failures and rebuild the array like a pro.

βœ… Maintenance: You can manage configurations, set up auto-mounting, and perform cleanups properly.

βœ… Troubleshooting: You can fix common issues like β€œdevice busy” errors or when the RAID fails to start.

You’re now equipped to manage RAID-6 arrays in enterprise environments or critical data setups!


πŸš€ Next Steps - Level Up Your Skills

Want to take your RAID skills further? Here are some advanced topics to explore:

  • Try RAID-10 (speed + mirroring):

bash

sudo mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
  • Add a hot spare (automatic replacement):

bash

sudo mdadm --manage /dev/md0 --add-spare /dev/sde1
  • Learn LVM on top of RAID: Combine Logical Volume Manager (LVM) with RAID-6 for flexible storage management.

  • Explore hardware RAID: Compare software RAID (like this tutorial) with hardware RAID controllers for performance and management differences.

  • Set up RAID monitoring with alerts: Configure tools like Nagios or Zabbix for real-time RAID monitoring in production.

  • Test RAID-6 with larger disks: Practice with larger virtual disks (e.g., 10GB) to simulate real-world rebuild times.


πŸ’¬ Final Words of Wisdom

RAID-6 is your go-to choice for enterprise-grade reliability when you need to protect critical data. It balances storage efficiency with the ability to survive two disk failures, making it ideal for:

βœ… Good for:

  • Enterprise file servers and NAS

  • Critical data storage (databases, backups)

  • Large disk arrays (1TB+ disks)

  • Systems requiring high availability

❌ Not ideal for:

  • Small setups with fewer than 4 disks

  • Applications needing maximum write speed

  • Budget-constrained environments (due to higher disk overhead)

Three Golden Rules:

πŸ”΄ RAID is NOT a backup! Fire, theft, or ransomware can destroy all disks. Always maintain separate backups (e.g., to an external drive or cloud).

🟑 Monitor your RAID regularly. Disks fail unexpectedly. Check health weekly or set up automated alerts to catch problems early.

🟒 Test your recovery plan. Practice rebuilding arrays and recovering data before a real failure. Know your commands and keep this guide handy.

You now have real-world RAID-6 skills! πŸŽ‰ You can confidently manage RAID arrays in production environments, ensuring data safety even in the face of multiple disk failures.

Keep practicing, stay curious, and may your arrays always stay in "clean" state! πŸ›‘οΈ