RAID implementation under Linux

Source: Internet
Author: User
Tags uuid disk usage

First, the purpose of the experiment

1. Mastering the implementation method of soft raid in Linux system;

2. Master the configuration process of RAID5;

3. Be familiar with RAID, 5 characteristics through experiment.

Second, the contents and steps of the experiment

1. Create a Linux in VMware.

2. Add the Linux to 4 virtual disks (select SCSI type. 2G).

3, the use of Madam in Linux to create RAID5, three disk to do RAID5. A disk to make a spare.

4. Format and mount the RAID5.

5. Create some files and directories in RAID5 for fault detection.

6, change the configuration file, let RAID5 boot their own active loading.

7, shut down the system.

8, delete a piece of hard disk (can be deleted after the second hard drive added).

9. Reboot the system. See if the data in the RAID5 volume is missing.

10, according to the experimental results to summarize the contents of the experiment.




Third, the experimental requirements

1. The results of the experiment were observed, recorded and compared, and the reasons should be found out.

2. A place in the experiment where naming is required. All are named by their own names, and can be distinguished by different suffixes. Two servers, such as Zhang San, can be named: Zhangsans1,zhangsans2.

Experimental steps and experimental process:

1. Install red Hat Enterprise Linux 6 in VMware first.

2, to Red Hat enterpriselinux 6 to add 4 virtual disks (SCSI,2G), three of them do RAID5, a spare disk.

3. Start Red Hat enterpriselinux 6.

4, to configure the RAID5.

5. Close Red Hat enterpriselinux 6.

6, delete a block after the addition of the disk (can delete the added second disk).

7. Start Red Hatenterprise Linux 6 again.

8, to test the RAID5 after the broken piece of disk, you can find that the data can still access the normal interview.

Number of disks required: three or more we are here to add six hard disks four blocks to do disk array. 1 block to prepare (spare) disk, another piece reserved for standby note: RAID5 disk usage is N-1 that is, four 100G of hard disk free space is 300G.

Experimental steps:

1 Check the disk devices in the system fdisk–l

2 the next command to create the raid is Mdadm, assuming that the MDADM package is not installed first

Rhel5 in the CD!

Mdadm--create--auto=yes/dev/md0--level=5--raid-devices=4--spare-devices=1/dev/sd[b-f]

Explanation of the parameters:

--create//indicates to create raid

--AUTO=YES/DEV/MD0//Newly established software disk display device for MD0,MD serial number can be 0-9

Level of--level=5//disk array. This is REID5.

--raid-devices//Join the number of blocks as a prestaged (spare) disk

/DEV/SD[B-F]//disk array used by the device, also can be written as "/DEV/SDB/DEV/SDD/DEV/SDE/DEV/SDF" the same can be abbreviated as: Mdadm–c/dev/md0–l5–n4–x1/de V/SD[B-F]

There are two ways to see if the raid was successful and whether the creation was performed properly

View specific information: Mdadm--detail/dev/md0 command to view specific information about RAID

Simpler view: Ability to view/proc/mdstat files directly to see RAID execution

Cat/proc/mdstat

Format and mount and use raid created

MKFS.EXE3/DEV/MD0//Format RAID5 disk as Mkfs.exe

MIKDIR/MNT/RAID5//Create a/RAID5 directory under/mnt to mount the md0

MOUNT/DEV/MD0/MNT/RAID5//Mount the md0 to RAID5

Check the Mount status

Df–ht

Try the new RAID is not able to use, write to the file

Set boot yourself to initiate raid and mount yourself actively

Let raid boot up, riad configuration file name Word is mdadm.conf, this file

It does not exist, it should be established by itself. The primary role of this configuration file is when the system starts to

Enough to take the initiative to load soft raid, at the same time it is convenient to manage later. Note, the mdadm.conf file is mainly made up of

The next section consists of:

The Devices option is formulated to compose the raid all device, and the array option specifies the

Device name, RAID level, number of active devices in the array, and the device's UUID number.

Initiate raid on your own initiative

First set up/etc/mdadm.conf this file

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

To make a change to this file: vi/etc/mdadm.conf

On the set RAID's own active mount

Change File Vi/etc/fstab

Add a line/dev/md0/mnt/raid5 ext3 defaults 0 0

Simulate disk corruption in RAID5, verify the functionality of the spare disk (in RAID5, agree to a disk

The spare disk that we set up will immediately replace the damaged disk with a raid heavy

Security of the data):

MDADM–MANAGE/DEV/MD0–FAIL/DEV/SDD//Use this command to set the status of SDD as an error

Check out the disk information: mdadm–-detail/dev/md0

Simply look at the raid scenario:

Created, which means that RAID5 has voluntarily recovered.

Check to see if RAID5 is working properly!

Write the data inside.

Remove the faulted disk and add a new disk to make an alternate spare disk

First delete the damaged disk SDD

MDADM–MANAGE/DEV/MD0--REMOVE/DEV/SDD//will be broken disk SDD from the raid except on adding a new piece as a spare disk:

MDADM–MANAGE/DEV/MD0--ADD/DEV/SDG//Add new disk as SDG

RAID5 expansion: Using Grow mode

Mdadm–manage/dev/md0--ADD/DEV/SDG Add a new hard drive

True members of active SYNC/DEV/SDB1 # raid

SPARE/DEV/SDC1 #raid备用成员

Mdadm–g/dev/md0–n "x" #-g is grow Mode "x" is the number of RAID true members

Number of command parameters

-A =--assemble active

-S =--stop stop

-D =--detail View raid specific information

-C =--Create a RAID device

-V =--verbose Displays specific information about the build process

-L =--level RAID level

-n = number of--raid-devices RAID devices

-s =--scan Scan raid device

-F =--fail marked bad hard drive

-A =--add Join the hard drive

-r =-remove removing bad hard drive

Now look at the disk information situation: MDADM–-DETAIL/DEV/MD0

How to turn off raid:

> Uninstall/dev/md0 directly, and stare at the configuration in the/etc/fstab file

UMOUNT/DEV/MD0//Lift Hook up

Vi/etc/fstab//Will fstab inside of the boot itself on the active mount stare out

#/dev/md0/mnt/raid5 exit3 Defaults 0 0

Experimental results:

The following points were completed through the experiment:

1. Mastering the implementation of soft raid under Linux system.

2. Master the configuration process of RAID5;

3. Be familiar with RAID, 5 characteristics through experiment.

Create a Linux in VMware.

Add the Linux to 4 virtual disks (choose SCSI type, 2G). Use Madam in Linux to create RAID5, three disks to do RAID5, one disk to make the spare. Format and mount the RAID5. Create some files and directories in RAID5 for fault detection.

Change the configuration file, let the RAID5 boot their own active loading.

Shut down the system.

Delete a hard drive (a second hard drive that can be added after deletion).

Restart the system to see if the data in the RAID5 volume is missing. According to the experimental results, the contents of the experiment were summarized.

Experiment Summary:

Learn some of the main operations and understand the fundamentals of RAID implementations:

The steps to configure the RAID1 are not very cumbersome relative to RAID5, but when using mdadm it should be noted that you should not partition multiple partitions on a hard disk, and then make multiple partitions into an array, which will not only improve the access speed of the hard disk, but reduce the overall system performance. The correct approach is to divide a hard disk into one or more partitions. The partitions of several different hard disks are then formed into an array.

In addition, the system folder such as/usr should not be placed in the array. The system will not perform properly once the array fails.

Set boot yourself to initiate raid and mount yourself actively

Let raid boot up, riad configuration file name Word is mdadm.conf, this file default is not exist, to build themselves. The main role of this configuration file is that the system can be activated by self-loading soft raid at the same time, it is convenient to manage later.

The mdadm.conf file consists mainly of the following sections:

The Devices option is formulated to compose the raid all device, and the array option specifies the

Device name, RAID level, number of active devices in the array, and the device's UUID number.

Initiate raid on your own initiative

First set up/etc/mdadm.conf this file

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

To make a change to this file: vi/etc/mdadm.conf

Data plays an important role in today's enterprise, and the security of data storage is one of the important problems that people should pay attention to in using computers. Often people in the server with a variety of redundant disk array RAID technology to protect data, high-end servers generally provide an expensive hardware RAID controller, but a lot of small and medium-sized enterprises do not have enough money to bear the cost.

Do we have a way to implement raid through software? In fact, in Linux under the software to achieve the hardware of the RAID function, so as to save investment, but also achieve very good results.


command to start and stop the RAID1 array. Start direct Run "mdadm-as/dev/md0" can.

Running Mdadm-s/dev/md0 stops the RAID1 array. In addition, after adding the command mdadm-as/dev/md0 in the Rc.sysinit startup script file, the array will be set to start with the system boot.


Implementing RAID under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.