Configure "Raid 10" in Linux
Configuring RAID 10 (RAID 1+0) in Linux involves combining multiple disks into a single RAID array that provides both redundancy and improved performance through a combination of mirroring and striping. RAID 10 requires a minimum of four disks and offers high fault tolerance and performance benefits. Here’s a step-by-step guide to configure RAID 10 using mdadm
on a Linux system, including CentOS 9:
Step-by-Step Guide to Configure RAID 10
Step 1: Install Required Packages
Ensure mdadm
(the utility for managing RAID arrays) is installed on your Linux system. Use the package manager appropriate for your distribution. For CentOS 9, you can use:
sudo dnf install mdadm
Step 2: Identify Disks
Identify the disks you want to use for RAID 10. For this example, assume you have four disks: /dev/sda
, /dev/sdb
, /dev/sdc
, and /dev/sdd
.
Step 3: Partition Disks
If your disks are new or need reconfiguration, partition them accordingly. You can use tools like fdisk
, parted
, or gdisk
to create partitions on each disk. For RAID 10, you typically create partitions of equal size across pairs of disks.
For example, partition /dev/sda
and /dev/sdb
:
sudo fdisk /dev/sda
Create a new partition (e.g., /dev/sda1
) covering the desired space. Repeat this for /dev/sdb
, /dev/sdc
, and /dev/sdd
.
Step 4: Create RAID 10 Array
Create the RAID 10 array using mdadm
. RAID 10 requires a minimum of four disks:
sudo mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
/dev/md0
is the name of the RAID device.--level=10
specifies RAID level 10 (RAID 1+0, combining mirroring and striping).--raid-devices=4
specifies the number of devices in the RAID array (in this case, four disks)./dev/sda1
,/dev/sdb1
,/dev/sdc1
, and/dev/sdd1
are the partitions created earlier on/dev/sda
,/dev/sdb
,/dev/sdc
, and/dev/sdd
.
Step 5: Verify RAID Configuration
Check the status of the RAID array to ensure it was created successfully:
sudo mdadm --detail /dev/md0
This command provides detailed information about the RAID array md0
, including its status, devices, and RAID level.
Step 6: Create a Filesystem
Next, create a filesystem on the RAID array. For example, to create an ext4
filesystem:
sudo mkfs.ext4 /dev/md0
Step 7: Mount the RAID Array
Create a mount point and mount the RAID array:
sudo mkdir /mnt/raid10
sudo mount /dev/md0 /mnt/raid10
Step 8: Configure Mount at Boot
To ensure the RAID array mounts automatically at boot time, add an entry to /etc/fstab
:
echo '/dev/md0 /mnt/raid10 ext4 defaults 0 0' | sudo tee -a /etc/fstab
Step 9: Test and Verify
Reboot your system to test if the RAID array mounts automatically and correctly. After rebooting, verify that the RAID array is still operational:
sudo mdadm --detail /dev/md0
Ensure that all disks (/dev/sda1
, /dev/sdb1
, /dev/sdc1
, /dev/sdd1
) are active and in sync (U
state).
Additional Notes:
Always replace
/dev/sda1
,/dev/sdb1
,/dev/sdc1
,/dev/sdd1
, etc., with the appropriate partitions on your disks.Customize RAID level (
--level
), RAID device name (/dev/md0
), filesystem type (ext4
), and mount point (/mnt/raid10
) as per your requirements.RAID 10 provides both high performance through striping and high fault tolerance through mirroring. It can tolerate the failure of one disk in each mirrored pair without data loss.
Monitor the RAID array regularly (
sudo mdadm --detail /dev/md0
) to ensure all disks are functioning properly and to detect any potential issues early.
By following these steps, you can successfully set up RAID 10 on CentOS 9 (or any Linux distribution) using mdadm
, providing robust data protection and performance benefits for your storage solution.