RAID Redundant Array of Inexpensive Disks namely, high availability and reliability for large-scale environments, as compared to normal use, more data needs to be protected. RAID is a collection of disks, containing a logical array. The drive can be combined together into a single array or called (group) collection.
Create RAID least two shall be used to connect to the RAID controller disks, to form a logical volume, according to the definition of RAID levels to add more drives to an array. Created without using physical hardware RAID is called software RAID. Software RAID is also called the poor RAID.
Creating RAID0 in Linux
The main purpose of using RAID is to save the data in a single point of failure, if we use a single disk to store data, if it is damaged, then there is no chance of getting to our data, in order to prevent loss of data we need a fault-tolerant method. So, we can use multiple disks RAID arrays.
What is in RAID 0 stripe
Strip is divided by the data at the same time on multiple disks. Suppose we have two disks, if we save the data to the logical volume, it saves the data on both disks. Use RAID 0 to achieve better performance, but if a drive fails, we will not get the full data. Therefore, RAID 0 is not a good practice. The only solution is to install RAID 0 logical volumes have the operating system to improve the security of important documents.
RAID 0 high performance.
On RAID 0, zero wasted space.
Zero fault tolerant (if any hard disk fails, the data can not be retrieved).
Write and read performance is very good.
The minimum number of disks to create a RAID 0 allowed is two, but you can add more disks, but the number should be even like 2,4,6,8. If you have a RAID card and has enough physical ports, you can add more disks.
Here, we do not use hardware RAID, this setting requires only software RAID. If we have a physical hardware RAID card, we can access it from its functional interface. Some motherboards default built-in RAID function, you can also use Ctrl + I key to access its interface.
If you are just starting to set RAID, please read our previous article, we have introduced some basic concepts of RAID.
RAID levels and concepts introduced
My server settings
Operating System: CentOS6.5Final
IP Address: 192.168.0.225
Two disk: 20 GB each
This is Part 2 of 9 tutorial series, in this section, we will look at how to create and use RAID 0 (striping), to name sdb and sdc two 20GB hard disk Case on Linux.
Step 1: Update system and installation of mdadm RAID management software
1, before setting RAID 0 on Linux, we first update about the system, and then install mdadm package. mdadm is a small program that will allow us to configure and manage RAID device under Linux.
# Yum clean all && yum update
# Yum install mdadm -y
Install mdadm tool
Step 2: Make sure the connection of the two 20GB hard drive
2, before creating RAID 0, be sure to confirm the two hard disks can be detected, use the following command to confirm.
# Ls -l / dev | grep sd
Check the hard disk
3, upon detecting a new hard drive, and check whether the drive has been connected to the use of the existing RAID, use the following mdadm command.
# Mdadm --examine / dev / sd [b-c]
Checking the RAID device
From the output above we can see, no RAID using sdb and sdc two drives.
Step 3: Create RAID partition
4. Now create RAID partitions with sdb and sdc, use the fdisk command to create. Here, I'll show you how to create partitions sdb drive.
# Fdisk / dev / sdb
Follow these instructions to create a partition.
Create a new partition by n.
Then press P to select a primary partition.
Next, select the partition number 1.
Simply press the Enter key twice to select the default value.
Then, press P to display the created partition.
Follow these instructions to create a partition for Linux RAID types.
Press L, lists all the available types.
Press t to modify the partition.
Type fd is set to Linux RAID type, and then press Enter.
Then use p again see our changes.
Use w to save your changes.
Creating a RAID partition on Linux
Note: Use the steps above to create partitions on the same drive sdc.
5. After you create the partition, verify that both drives are correctly defined RAID, use the following command.
# Mdadm --examine / dev / sd [b-c]
# Mdadm --examine / dev / sd [b-c] 1
Verify RAID partition
Step 4: Create RAID md devices
6, now use the following command to create the md device (ie, / dev / md0), and select the appropriate RAID level.
# Mdadm -C / dev / md0 -l raid0 -n 2 / dev / sd [b-c] 1
# Mdadm --create / dev / md0 --level = stripe --raid-devices = 2 / dev / sd [b-c] 1
-C - Create
-l - Level
-n - RAID device number
7, once the md device has been established, use the following command can view the status of the RAID level, and an array of equipment.
# Cat / proc / mdstat
See RAID Level
# Mdadm -E / dev / sd [b-c] 1
See RAID device
# Mdadm --detail / dev / md0
See RAID arrays
Step 5: RAID device to create a file system
8, will create a RAID device / dev / md0 for the ext4 file system and mounted under / mnt / raid0.
# Mkfs.ext4 / dev / md0
Creating ext4 file system
9. After creating the ext4 file system on the RAID device, now create a mount point (that is, / mnt / raid0), and the device / dev / md0 mount it under.
# Mkdir / mnt / raid0
# Mount / dev / md0 / mnt / raid0 /
10, Next, use the df command to verify that the device / dev / md0 is mounted under / mnt / raid0.
# Df -h
11. Next, under the mount point / mnt / raid0 create a file named tecmint.txt, and add some content files created, and view the contents of files and directories.
# Touch /mnt/raid0/tecmint.txt
# Echo "Hi everyone how you doing?"> /mnt/raid0/tecmint.txt
# Cat /mnt/raid0/tecmint.txt
# Ls -l / mnt / raid0 /
Verify mounted equipment
12, when you verify the mount point, you can add it to / etc / fstab file.
# Vim / etc / fstab
Add the following entries, depending on the location of your installation and use of the file system, making changes on their own.
/ Dev / md0 / mnt / raid0 ext4 deaults 00
Adding devices to the fstab file
13, using the -a mount command to check the fstab entry is wrong.
# Mount -av
Check whether the fstab file is incorrect
Step 6: Save the RAID configuration
14. Finally, save the RAID configuration to a file for future use. Again, we use the mdadm command with the -s (scan) and -v (verbose) option, as shown in FIG.
# Mdadm -E -s -v >> /etc/mdadm.conf
# Mdadm --detail --scan --verbose >> /etc/mdadm.conf
# Cat /etc/mdadm.conf
Save RAID configuration
In this way, we are here to see how to use two hard disk configurations with a striped RAID 0. In the next article, we will see how to set up RAID 5.