Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Using RAID in Linux: Create a RAID 5     - C ++ you can become a new scripting language (Programming)

- After installing Ubuntu 15.04, to do a few things (Linux)

- Change CentOS 7 NIC name eno16777736 to eth0 (Linux)

- How to install Bugzilla 4.4 on Ubuntu / CentOS 6.x (Linux)

- 14 useful example Linux Sort command (Linux)

- CentOS Nginx achieve 3 virtual machine load balancing (Server)

- Linux Network Programming --epoll model Detailed principles and examples (Programming)

- Java developers question (Programming)

- Get the Linux device PCI ID method (Linux)

- Linux package management operations Basic entry (Linux)

- Memory leak analysis using Android studio (Programming)

- Function Getting the Linux shell (Programming)

- Ubuntu 14.04 + xRDP + Xfce implement Windows Remote Desktop Connection (Linux)

- I like Linux Security (Linux)

- Android code performance optimization tips (Programming)

- Use web2py + uWSGI + Nginx Web server built on Linux (Server)

- Ceph cluster disk is no workaround for the remaining space (Server)

- Through eight skills to let you become a super Linux end-user (Linux)

- Using Vagrant create cross-platform development environment (Linux)

- Ubuntu 15.04 installed JDK and configured as the default JDK (Linux)

  Using RAID in Linux: Create a RAID 5
  Add Date : 2018-11-21      
  After RAID 5, data is striped across multiple disks distributed parity stored. Distributed parity striping and parity information means that it will striping data across multiple disks, so there will be good data redundancy.

RAID 5 configuration in Linux

For this RAID level it should be at least three or more disks. RAID 5 is generally used in mass production environments, to spend more of the cost to provide better data redundancy.

What is Parity?

Parity is an error detection in the data storage easiest way common. Parity information is stored on each disk, for example, we have four disks, which is equivalent to a size of the disk space to store all of the disk is divided parity information. If any one disk fails, we can replace the failed disk after to obtain the original data from the parity information reconstruction.

Advantages and disadvantages of RAID 5

Provide better performance.
Support redundancy and fault tolerance.
Supports hot backup.
The parity information storage capacity spent a disk.
A single disk without loss of data after a failure. Reconstruct data from the parity information we can replace the failed disk.
Suitable for transaction-oriented environments, the read operation will be faster.
Because parity footprint, the write operation will be slower.
Reconstruction takes a long time.


Create a RAID 5 requires a minimum of three disks, you can also add more disk, provided you how dedicated hardware RAID controller port. Here, we use "mdadm" package to create a software RAID.

mdadm is a allows us to configure and manage RAID device packages under Linux. No RAID configuration files by default, we have to save the configuration file in a separate file in mdadm.conf after creating and configuring RAID.

Before going any further, I suggest you go to learn the basics of the Linux RAID through the following article.

My server settings

Operating System: CentOS6.5Final
IP Address:
Host Name: rd5.tecmintlocal.com
Disk 1 [20GB]: / dev / sdb
Disk 2 [20GB]: / dev / sdc
Disk 3 [20GB]: / dev / sdd
This is Part 4 of 9 tutorial series, where we use three 20GB on a Linux system or server (named / dev / sdb, / dev / sdc and / dev / sdd) disks with distributed build parity software RAID 5.

Step 1: Install and test disk mdadm

1, as we said earlier, we are using CentOS 6.5 Final version to create a RAID set, but the same also applies to other Linux distributions.

# Lsb_release -a
# Ifconfig | grep inet

CentOS 6.5 Summary

2, if you follow the series to our RAID configuration, we assume that you have installed the "mdadm" package, if not, use the following command according to your Linux distribution installed.

# Yum install mdadm [in RedHat System]
# Apt-get install mdadm [in Debain system]
3, "mdadm" After the package is installed, use the fdisk command to list our first increase in three 20GB hard disk on the system.

# Fdisk -l | grep sd

Install mdadm tool

4. Now check whether there are three RAID disk blocks, use the following command to check.

# Mdadm -E / dev / sd [b-d]
# Mdadm --examine / dev / sdb / dev / sdc / dev / sdd # or

Check Raid Disk

Note: The above picture shows that did not detect any superblock. So, these three disks not defined in the RAID. Let us now begin to create a bar!

Step 2: Create a RAID disk partition

5, first of all, before you create the RAID front disk (/ dev / sdb, / dev / sdc and / dev / sdd) must have a partition, therefore, proceeding to the next to use the fdisk command to partition.

# Fdisk / dev / sdb
# Fdisk / dev / sdc
# Fdisk / dev / sdd
Create / dev / sdb partition

Please create a partition on / dev / sdb hard disk follow the instructions below.

Create a new partition by n.
Then press P to select a primary partition. Select the primary partition is not yet defined because too much area.
Next, select the partition number 1. The default is 1.
Here is a selection cylinder size, we do not need to select the designated size, because we need to use the entire partition RAID, so just press the Enter key twice to assign the entire capacity of the default to it.
Then, press P to print the created partition.
Change the partition type, press L to list all available types.
Press t modify partition type.
As used herein, fd set of RAID types.
Then use p again see our changes.
Use w to save your changes.

Create sdb partition

Note: We still have to follow the steps above to create sdc and sdd partitions.

Create / dev / sdc partition

Now, given the creation method sdc and sdd disk partition by the screenshot below, or you can follow the steps above.

# Fdisk / dev / sdc

Create sdc partition

Create / dev / sdd partition

# Fdisk / dev / sdd

Create Partition sdd

6, create a partition, check the three disks sdb, change sdc, sdd's.

# Mdadm --examine / dev / sdb / dev / sdc / dev / sdd
# Mdadm -E / dev / sd [b-c] # or

Check Disk Changes

Note: In the above image, the type of disk is fd.

7, now in the newly created partition checks RAID block. If it detects no superblock, we can proceed to create a new RAID 5 configuration in these disks.

Check Raid on Partition

* Check in the partition RAID *

Step 3: Create the md devices md0

8, now use all the newly created partition (sdb1, sdc1 and sdd1) to create a RAID device "md0" (ie, / dev / md0), use the following command.

# Mdadm --create / dev / md0 --level = 5 --raid-devices = 3 / dev / sdb1 / dev / sdc1 / dev / sdd1
# Mdadm -C / dev / md0 -l = 5 -n = 3 / dev / sd [b-d] 1 # or
9. After you create a RAID device, check to make sure RAID, from mdstat output can be seen in RAID levels including equipment.

# Cat / proc / mdstat

Verify Raid equipment

If you want to monitor the current creation process, you can use the watch command, cat / proc / mdstat passed to it, it will appear on the screen and are refreshed every 1 second.

# Watch -n1 cat / proc / mdstat

Monitoring RAID 5 build process

Raid 5 Process Summary

10. After you create RAID, use the following command to verify the RAID device

# Mdadm -E / dev / sd [b-d] 1

Raid level verification

Note: because it shows information for three disks, the output of the command will be a little longer.

11. Next, verify that RAID array, assuming that the device contains a RAID is running and has begun re-synchronization.

# Mdadm --detail / dev / md0

Verify RAID arrays

Step 4: Create a file system md0

12, creates ext4 file system "md0" equipment in front of the mount.

# Mkfs.ext4 / dev / md0

Md0 create a file system

13 Now, created in the / mnt directory raid5, then mount the file system to the / mnt / raid5 / down, and check the file under the mount point, you will see the lost + found directory.

# Mkdir / mnt / raid5
# Mount / dev / md0 / mnt / raid5 /
# Ls -l / mnt / raid5 /
14, create several files at the mount point / mnt / raid5, and add some content in one of the files and then to verify.

# Touch /mnt/raid5/raid5_tecmint_{1..5}
# Ls -l / mnt / raid5 /
# Echo "tecmint raid setups"> / mnt / raid5 / raid5_tecmint_1
# Cat / mnt / raid5 / raid5_tecmint_1
# Cat / proc / mdstat

Mount RAID device

15, we need to add an entry in fstab, otherwise we will not be displayed after system reboot mount point. Edit fstab file to add an entry in the file to chase them down. Mount point vary depending on your environment and different.

# Vim / etc / fstab
/ Dev / md0 / mnt / raid5 ext4 defaults 00

Automatically mount RAID 5

16. Next, if there are errors running the mount -av command to check fstab entry.

# Mount -av

Error checking Fstab

Step 5: Save the configuration of Raid 5

17, in the previous chapters have already said, there is no default RAID configuration file. We have to manually save. If you do not follow this step does not belong md0 RAID device, it will be some other random number.

Therefore, we must save the configuration before the system is restarted. If the configuration is saved it will be loaded when the system is rebooted into the kernel and then RAID will also be loaded.

# Mdadm --detail --scan --verbose >> /etc/mdadm.conf

Save RAID 5 configuration

Note: Save the configuration of the device will remain md0 RAID levels stable.

Step 6: Add a backup disk

18, what is the use spare? It is very useful if we have a spare disk in the array when we any one disk fails, the backup disk will enter the active reconstruction process, and synchronize the data from the other disk, so there is a redundancy.

More on adding spare disks and RAID 5 fault tolerance inspection instructions, read the article below in step 6 and 7.

Add a backup disk In RAID 5
in conclusion

In this article, we have seen how to use three disks to configure a RAID 5. In the next article, we will see how and when troubleshooting a RAID 5 disk how to restore the damage.
- Java reflection Introduction (Programming)
- The Samba service does not have permission to access (Server)
- Tmux Crash Course: Tips and adjustment (Linux)
- Read the official GNU Make manual one (chapter 1-2) (Programming)
- Linux directory configuration (Linux)
- How to Set Free SSH password on CentOS / RHEL (Linux)
- RMAN backup file is much larger than the size of the database Cause Analysis (Database)
- MySQLbinlog combat on using data recovery (Database)
- Lua regex (string function) (Programming)
- Java reflection summary (Programming)
- Android project using the command to create and install the package (Programming)
- CentOS6.5 install SVN & visual management tools iF.SVNAdmin (Server)
- Linux - use chroot command (Linux)
- Modify MySQL character encoding under Linux (Database)
- MySQL EXPLAIN SQL output description (Database)
- Talk about jsonp (Programming)
- ACL permissions Linux command (Linux)
- MySQL Data Types (Database)
- to install the deployment of LVS under CentOS 7.0 (Server)
- CentOS6 5 Configure SSH password Free (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.