Run RAID5 in Linux

Source: Internet
Author: User

RAID5 + disk quota, four disks, divided into four equal partitions and two GB, three of which are made into RAID 5 partitions, and the remaining one is used as a redundant disk and mounted to the/RAID5 directory, when one disk is damaged, the redundant disk status automatically changes to active.

1. Add four new disks and add new disk partitions.

The steps for creating SDC, SDD, and SDE are the same as those above,

3. Create a RAID5 device (Note: At least 3 disks, the number of disks can be odd or even) and view the array status

-C: Create a raid block device after the raid block device name-L 5: specify the number of RAID 5-N 3 disks used to create the RAID 5, that is, the number of active disks. RAID5 has at least three disks, -x 1 Number of backup disks,

4. Format and mount raid5.

5. view the details. The three disks in the active status are active, and those in the spare status are backup disks.

4. simulate a disk failure and view the RAID5 information,

It can be found that the backup disk sde1 is automatically converted to active, and sdc1 is in the faulty spare status,

5. Remove the invalid partition, view the RAID5 information, and find that sdc1 has been removed,

6. Re-Add the partition and view the RAID5 information. It is found that sdc1 has changed to the standby status.

If you want to change it to active state directly, you also need a command to add it as a backup state,

In this way, the backup partition is added to the raid member, and the capacity is also increased.

 

[Root @ localhost ~] # Mdadm-g/dev/md0-N 4

 

7. Create a RAID configuration file. If there is no configuration file, it cannot be activated after the raid is stopped,


 

8. Disable and enable

When you view the information again, the system prompts that the device is not active.

To enable raid, run the following command,

 

Delete raid:

1. Delete all disks or partitions corresponding to raid

Mdadm/dev/md0 -- fail/dev/SD [B, c, d, e, f] 1 -- remove/dev/SD [B, c, d, e, f] 1

2. Stop raid

Mdadm -- stop/dev/md0

3. Clear the raid information in the disk (partition) super block.

Mdadm -- MISC -- zero-superblock/dev/SD [B, c, d, e, f] 1

 

Mdadm usage reference)
Mdadm is a tool for managing software raid in Linux.
The following content is from the manpage:
Basic Syntax: mdadm [mode] [Options]
There are 7 [mode] types:
Assemble: adds an array previously defined to an existing array.
Build: Build a legacy array. Each device has no superblocks
Create: Create a new array with each device having a superblocks
Manage: Manage arrays, such as add or remove
Misc: allows a device in the array to be used independently, for example, to erase superblocks or terminate an array in use.
Follow or monitor: monitors the status of RAID, and multipath
Grow: Change the raid capacity or the number of devices in the array
Available [Options]:
-A, -- assemble: adds a previously defined array
-B, -- Build: Build a legacy array without superblocks.
-C, -- create: Create a new array
-Q, -- Query: view a device and determine whether it is a MD device or a part of a MD array.
-D, -- detail: Print details of one or more MD Devices
-E, -- examine: print the content of the MD superblock on the device.
-F, -- follow, -- monitor: select the monitor mode.
-G, -- grow: changes the size or form of the array in use.
-H, -- help: help information. This option is displayed after the preceding options are used.
-- Help-Options
-V, -- version
-V, -- verbose: displays details
-B, -- Brief: less details. Used for -- detail and -- Examine options
-F, -- force
-C, -- Config =: Specifies the configuration file. The default value is/etc/mdadm. conf.
-S, -- Scan: scan the configuration file or/proc/mdstat to search for lost information. Configuration file/etc/mdadm. conf
Options used by create or build:
-C, -- chunk =: Specify chunk size of kibibytes. The default value is 64.
-- Rounding =: Specify rounding factor for Linear Array (= chunk size)
-L, -- level =: Set the raid level.
-- Create available: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, RAID5, 5, raid6, 6, multipath, MP.
-- Build available: linear, raid0, 0, stripe.
-P, -- parity =: Set the RAID 5 parity rules: eft-asypolicric, left-semi Ric, right-asypolicric, right-semi Ric, La, Ra, ls, Rs. the default value is left-semi Ric.
-- Layout =: similar to -- parity
-N, -- raid-devices =: specifies the number of available devices in the array. This number can only be modified by -- grow.
-X, -- spare-devices =: specify the number of surplus devices of the initial array.
-Z, -- size =: total space obtained from each device after raid1/0/6 is set
-- Assume-clean: currently only used for the -- Build Option
-R, -- run: when a part of the array appears in another array or file system, mdadm confirms the array. This option is not confirmed.
-F, -- force: Generally, mdadm does not allow creating arrays with only one device, and a device is used as missing drive when creating RAID 5. This option is the opposite.
-A, -- Auto {= No, yes, MD, MDP, part, p} {NN }:

 

 

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.