Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to Create a RAID 6 Array on Linux

Table of Contents

When you’re managing critical data, redundancy is non-negotiable. RAID 6 Array on Linux is a powerful solution that offers fault tolerance and ample usable storage. The process of creating a RAID 6 array using mdadm on a Linux system is described below.

What is RAID 6?

RAID 6 (Redundant Array of Independent Disks, level 6) stripes data across multiple drives while also storing two parity blocks per stripe. This allows the array to survive two simultaneous disk failures – a significant improvement over RAID 5, which only tolerates one failure.

Key Benefits:

  • Double redundancy: Can handle two disk failures.
  • High capacity: More usable space than RAID 1 or RAID 10.
  • Distributed parity: Balanced write operations across all drives.

Keep in Mind:

  • You need a minimum of four drives.
  • Two disks’ worth of capacity is used for parity.
  • Performance in degraded mode (when a disk fails) can be very poor.

Step 1: Identify Available Disks

Use lsblk to identify which drives you want to include in your RAID array.

lsblk

Sample Output:

NAME     SIZE FSTYPE   TYPE MOUNTPOINT
sda      100G                     disk 
sdb      100G                     disk 
sdc      100G                     disk 
sdd      100G                     disk 

In this example, we’ll use /dev/sda, /dev/sdb, /dev/sdc, and /dev/sdd as RAID components.

Step 2: Hard drives partitioning

Use the fdisk command (fdisk -l) to inspect hard disks.

Use the below command to start the first disk’s partitioning. This will cause the fdisk menu to appear. If your disk name differs, replace it with your own.

fdisk /dev/sda
  • To start a new partition, type n.
  • To designate this as the primary partition, enter p.
  • Type the partition number, 1.
  • To respond by default to the first and last sector prompts, simply hit the enter key.
  • To choose the recently created partition, enter t.
  • set up Linux RAID on the partition.
  • To write all of these modifications to the disk, enter w.

For the remaining disks, we now have to follow exactly the same procedures. That would be disk /dev/sdb, /dev/sdc and /dev/sdd in our scenario.

Step 3: Create the RAID 6 Array

Use the mdadm command to create the array:

sudo mdadm --create --verbose /dev/md0 --level=6 --raid-devices=4 /dev/sda /dev/sdb /dev/sdc /dev/sdd
  • /dev/md0 is the new RAID device.
  • –level=6 specifies RAID 6.
  • –raid-devices=4 tells mdadm how many drives you’re using.

Step 4: Monitor the Array Build

The array will begin syncing in the background. Check the progress with:

cat /proc/mdstat

Example Output:

md0 : active raid6 sdd[3] sdc[2] sdb[1] sda[0]
      209584128 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/4] [UUUU]
      [>....................]  resync =  0.6% (668572/104792064) finish=10.3min speed=167143K/sec

You can continue using the system while the array syncs.

Step 5: Format and Mount the RAID Array

Create the Filesystem:

sudo mkfs.ext4 -F /dev/md0

Create a Mount Point:

sudo mkdir -p /mnt/md0

Mount the RAID Array:

sudo mount /dev/md0 /mnt/md0

Check Disk Usage:

df -h

Output Example:

Filesystem      Size  Used Avail Use% Mounted on
/dev/md0        197G   60M  187G   1% /mnt/md0

The array is now formatted, mounted, and ready for use.

Step 6: Save the Array Configuration

To ensure the array assembles on boot. Save Array Info to mdadm.conf

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

Update Initramfs:

sudo update-initramfs -u

Step 7: Automount the RAID Array

Add the mount configuration to /etc/fstab. This ensures the RAID 6 array mounts automatically at boot.

echo '/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab

Conclusion

Successfully configured a RAID 6 array with Linux mdadm. You now have a fault-tolerant storage solution capable of surviving two disk failures with good performance and usable capacity. RAID 6 is ideal for environments where data integrity and uptime are critical. With proper monitoring and backups, it can be a solid foundation for your storage strategy.

If you’re planning to set up a RAID 6 Array on Linux but need expert guidance or a hassle-free deployment, our team is here to help. At Skynats, we specialize in comprehensive Linux Server Management services, ensuring your servers are configured for maximum reliability, performance, and data protection. Contact us today to get professional support for building and maintaining secure, optimized Linux environments.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Let us know your requirement.

Can't get what you are looking for?

Get Support Right Away!