RAID 10, also known as RAID 1+0, is a popular RAID configuration that combines the advantages of both RAID 1 (mirroring) and RAID 0 (striping). It provides high performance, redundancy, and fault tolerance. In this comprehensive guide, we’ll walk you through the steps on how to create a software RAID 10 on Oracle Linux using mdadm
. Let’s get started!
Prerequisites
Before you proceed, ensure you have the following:
- Oracle Linux installed on your system.
- Four or more hard drives or SSDs with equal sizes.
- Familiarity with RAID 1 and RAID 0.
How to Create Software RAID 10 on Oracle Linux
Install mdadm
on Oracle Linux
mdadm
is a Linux utility used to manage and monitor software RAID devices. First, update your package index and then install mdadm
:
sudo yum update
sudo yum install mdadm
Partition the Disks on Oracle Linux
To create a RAID 10 array, you need to partition your disks. In this example, we’ll use four disks: /dev/sdb
, /dev/sdc
, /dev/sdd
, and /dev/sde
. Use the fdisk
command to create partitions on each disk:
sudo fdisk /dev/sdb
Follow these steps for each disk:
- Press
n
to create a new partition. - Press
p
for a primary partition. - Press
1
to set the partition number. - Press
Enter
twice to accept the default start and end sectors. - Press
t
to change the partition type. - Enter
fd
to set the partition type to “Linux RAID autodetect.” - Press
w
to write the changes and exit.
Repeat these steps for /dev/sdc
, /dev/sdd
, and /dev/sde
.
Create the RAID 10 Array on Oracle Linux
Now, create the RAID 10 array using the mdadm
command:
sudo mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
This command creates a RAID 10 array (--level=10
) with four devices (--raid-devices=4
) using the partitions created earlier.
Verify the RAID Array
Check the RAID array status using the following command:
cat /proc/mdstat
You should see output similar to this:
Personalities : [raid10]
md0 : active raid10 sde1[3] sdd1[2] sdc1[1] sdb1[0]
1048576 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]
This output indicates that the RAID array is active and all devices are in a healthy state.
Create a Filesystem on Oracle Linux
Now, create a filesystem on the RAID 10 array. We’ll use the ext4
filesystem in this example:
sudo mkfs.ext4 /dev/md0
Mount the RAID Array
Create a mount point for the RAID array:
sudo mkdir /mnt/raid10
Mount the RAID array to the newly created mount point:
sudo mount /dev/md0 /mnt/raid10
To automatically mount the RAID array at boot, you need to update the /etc/fstab
file. First, obtain the UUID of the RAID array using the blkid
command:
sudo blkid /dev/md0
The output will look similar to this:
/dev/md0: UUID="c3796a79-6d24-4a23-a8e7-e74fc2d85d45" TYPE="ext4"
Copy the UUID value, then open the /etc/fstab
file with a text editor:
sudo vim /etc/fstab
Add the following line at the end of the file, replacing your_uuid
with the UUID you copied earlier:
UUID=your_uuid /mnt/raid10 ext4 defaults 0 0
Save and close the file. The RAID 10 array will now mount automatically at boot.
Test the RAID Array
To test the RAID array, create a test file in the /mnt/raid10
directory:
sudo touch /mnt/raid10/test_file.txt
Verify that the file was created successfully:
ls /mnt/raid10
You should see test_file.txt
in the output.
Monitor the RAID Array
To monitor the RAID array, you can use the mdadm
command with the --detail
option:
sudo mdadm --detail /dev/md0
This command displays detailed information about the RAID array, such as its status, devices, and more.
Conclusion
Congratulations! You have successfully created a software RAID 10 array on Oracle Linux using mdadm
. RAID 10 provides both high performance and fault tolerance, making it an excellent choice for mission-critical applications. If you’d like to explore other RAID configurations, check out our guides on RAID 1 and RAID 5. To further enhance your Oracle Linux system, consider learning about VirtualBox, KVM, or Ansible.