Introduction to the RAID technology
The term RAID stands for Redundant Array of Independent Disks. It represents a storage technology which combines multiple disk drives to increase performance and increase reliability. There are three types of RAID: Hardware (controller card), Integrated (“Fake or pseudo RAID” provided by the BIOS on the motherboard or some low-end cards) and Software (OS).
Nowadays the Software RAID is a cost effective, flexible and reliable alternative to the Hardware RAID for home office PC’s, SME’s servers or even found in some corporate external storage systems. Let’s point out that the RAID technology does not replace the regular backups to another location. In example a voltage spikes, viruses, failures or disasters still could lead to corrupted and unrecoverable data.
RAID 10 is known as a “stripe of mirrors” and combines the features of RAID0 (striping) and RAID1 (mirroring). It outperforms RAID 5 in terms of read and write operations.
The diagram below illustrate a distribution of 8 data blocks [A1, …, A8] across even (at least 4) equivalent sized disks [Disk 1, …, Disk 4]. The size of the RAID device is equal to the total size for the half (in this particular case 2) of the disks.
Let’s configure RAID 10 on CentOS 6.5 at install
I will skip the whole OS installation process steps and will share just the relevant screens. The main idea is to create custom layout, where we will define 3 partitions for each of the 4 (x 20GB) disks and create the correspondent software RAID devices:
swap 2048 MB (twice the RAM size)
/ approx. 35 GB (the rest of the available space)
Maybe it is a good idea to split the 35GB into two RAID arrays – one for the root FS and another for data or performance benchmarks. But for simplicity I will leave it as it is.
Click on the [Create] button on the main screen > then select “RAID Partition” from the dialog and click the [Create] dialog button.
We are going to create one by one 4 boot partitions for sda,sdb,sdc,sdd. I choose 500 MB (experimentally discovered that we need to add 1 MB, which is used most probably for system information).
When done with all 4 partitions click again on the [Create] button on the main screen. This time we have 4 available partition and can create “RAID Device” for those partitions.
Please make sure that we select all 4x501MB partitions, /boot for mount point and RAID1 for RAID level (the boot partition cannot be installed on RAID10 device).
Create another 4 x 2049MB partitions, which will be used for swap. Why 2049, but not 2048? The partitions and software raid devices consumes some MB for system information. On the other size we can put only integers in the “Size (MB)” field. When done click on create in order to create the swap RAID device. Please do not chose mount point, but rather select the “swap” as a File System Type, RAID10 and all the sd*2 partitions created earlier.
Create 4 partitions, one by one, which will be used for the root file system.
Create the RAID device based on those partitions.
Click on the Format button.
Write changes.
Accept the default. After the installation CentOS will perform sync and the bootloader will be replicated to the disks.
Well known issue is that the CentOS Software RAID will not load GRUB on /dev/md0. It can be reproduced if we choose /dev/md0 on the previous step and then the CentOS won’t boot. Therefore we need to fix the boot loader:
1. Using the CentOS install media, boot to the rescue mode
2.select continues
3. select the “start shell” option
4. Enter the following command: chroot /mnt/sysimage
5. Re-install GRUB: grub-install /dev/md0
6. Reboot
In CentOS run Applications > System Tools > Disk Utility and review the layout or in a root console run the “palimpsest” command.
We have various options to monitor and control the array.
This article was written using a Virtualbox, so I don’t believe that any benchmark will be accurate. So let me share a real one, performed on Asus V8 and CentOS 6.5.
I don’t have spare non-raid drive on that machine at the moment, except Toshiba disk in an external USB3 enclosure. But anyway the read speed’s should be much slower for a regular SATA drive.
In terms of administration we could run a CLI tool called mdadm, which is used for building, managing, and monitoring Linux md devices (aka RAID arrays). More info could be found in the help and manual pages.
mdadm –help;
man mdadm;
[root@mbis1 ~]# cat /proc/mdstat
Personalities : [raid10] [raid1] md0 : active raid1 sda2[0] sdc2[2] sdb2[1] sdd2[3] 526324 blocks super 1.0 [4/4] [UUUU] md2 : active raid10 sda3[0] sdc3[2] sdb3[1] sdd3[3] 908602368 blocks super 1.1 512K chunks 2 near-copies [4/4] [UUUU] bitmap: 0/7 pages [0KB], 65536KB chunk
md1 : active raid10 sdc1[2] sdd1[3] sdb1[1] sda1[0] 67109888 blocks super 1.1 512K chunks 2 near-copies [4/4] [UUUU] unused devices:
[root@mbis1 ~]# mdadm –detail /dev/md2
/dev/md2:
Version : 1.1
Creation Time : Fri Mar 28 13:11:55 2014
Raid Level : raid10
Array Size : 908602368 (866.51 GiB 930.41 GB)
Used Dev Size : 454301184 (433.26 GiB 465.20 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Fri Apr 4 14:45:54 2014
State : active
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : near=2
Chunk Size : 512K
Name : mbis1:2 (local to host mbis1)
UUID : 22c551dc:10867cba:79c354e6:6f0d2b70
Events : 2765
Number Major Minor RaidDevice State
0 8 3 0 active sync /dev/sda3
1 8 19 1 active sync /dev/sdb3
2 8 35 2 active sync /dev/sdc3
3 8 51 3 active sync /dev/sdd3
We could install and use Webmin as a GUI
# Install cd /opt
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.680-1.noarch.rpm
wget http://www.webmin.com/jcameron-key.asc
rpm –import jcameron-key.asc
rpm -Uvh webmin-1.670-1.noarch.rpm
# Manage /etc/init.d/webmin start
/etc/init.d/webmin stop
/etc/init.d/webmin restart
/etc/init.d/webmin status # Change the default password if needed /usr/libexec/webmin/changepass.pl /etc/webmin root secretpassword # Change the default port if needed Login to Webmin as a root >> Webmin >> Webmin Configuration >> Ports and Addresses
Access the Webmin from a Web Browser using the root user and password, localhost or FQDN addres and the default port 10000: http://localhost:10000 > Hardware > Linux RAID
The Webmin Linux RAID option is quite useful.
CONCLUSION
We have setup CentOS 6.5 system with a software RAID10 array’s. When someone wants to improve the availability, reliability and the flexibility of his computer system then RAID10 is the way to go. Further step will be to look for solid state drives instead of the regular SATA disks. If you want to achieve something more, then you need to look for another RAID levels and different storage technologies. My personal opinion is that RAID10 will fit most of the individual or small and medium company needs.