Home Operation and Maintenance Linux Operation and Maintenance Detailed explanation of the implementation of software raid 5

Detailed explanation of the implementation of software raid 5

Jun 25, 2017 am 10:09 AM
raid software

Implementation of software raid 5

RAID 5 is a storage solution that takes into account storage performance, data security and storage cost. RAID 5 can be understood as a compromise between RAID 0 and RAID 1. RAID 5 can provide data security for the system, but the level of protection is lower than Mirror and the disk space utilization is higher than Mirror. RAID 5 has a data reading speed similar to RAID 0, but has an additional parity check information, and the writing speed of data is slightly slower than writing to a single disk. At the same time, because multiple data correspond to one parity information, RAID 5 has a higher disk space utilization than RAID 1, and the storage cost is relatively low. It is a solution that is currently used

1 Partition

Here we use the two partitions /dev/sda8 and /dev/sda9 and the two partitions /dev/sdb and /dev/sdc a hard drive.

Note: Remember to change the partition ID to fd

2 Create raid 5

mdadm -C /dev/md5 -a yes -l 5 -n 3 -x 1 /dev/sdd1 /dev/sde1 /dev/sdf /dev/sdb2
Copy after login
[root@centos7 ~]# mdadm -C /dev/md5 -a yes -l 5 -n 3 -x 1 /dev/sda8 /dev/sda9 /dev/sdb /dev/sdc

mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
Copy after login

-C Creation mode

-n #: Use # fast devices to create secondary RAID

-l #: Specify the level of RAID to be created

-a{yes|no}: Automatically create the device file of the target RAID device

-c CHUNK_SIZE: Specify the block size

-x #: Specify the number of spare disks, The one placed at the end defaults to the spare disk

3 Create a file system

[root@centos7 ~]# mkfs.ext4 /dev/md5
Copy after login

##4 Mount

(1) Create the mount directory

[root@centos7 ~]# mkdir /mnt/raid5
Copy after login
(2) Mount

[root@centos7 ~]# mount /dev/md5 /mnt/raid5
Copy after login

5 Generate configuration file

[root@centos7 ~]# cat /etc/mdadm.conf

ARRAY /dev/md5 metadata=1.2 spares=1 name=centos7.3.loacl:5 UUID=5ec4115c:ab1e25c8:ff36d8a2:74f6fd8a
Copy after login
View the status of md

[root@centos7 ~]# cat /proc/mdstat

Personalities : [raid0] [raid6] [raid5] [raid4]
md5 : active raid5 sdb[4] sdc[3](S) sda9[1] sda8[0]
2095104 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
Copy after login
View raid The details

[root@centos7 ~]# mdadm -D /dev/md5

/dev/md5:
Version : 1.2
Creation Time : Tue Apr 25 14:38:54 2017
Raid Level : raid5
Array Size : 2095104 (2046.00 MiB 2145.39 MB)
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent

Update Time : Tue Apr 25 14:50:08 2017
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1

Layout : left-symmetric
Chunk Size : 512K

Name : centos7.3.loacl:5 (local to host centos7.3.loacl)
UUID : 5ec4115c:ab1e25c8:ff36d8a2:74f6fd8a
Events : 18

Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
4 8 16 2 active sync /dev/sdb

3 8 32 - spare /dev/sdc
Copy after login
can be seen as composite expected, three active devices, one idle (standby) device

6 Disable and Enable

umount /mnt/raid0

mdadm -S /dev/md0

mdadm -A /dev/md0
Copy after login
(1) Disable raid

[root@centos7 ~]# umount /mnt/raid5
[root@centos7 ~]# mdadm -S /dev/md5
mdadm: stopped /dev/md5
Copy after login
Check and you can see that it has been stopped successfully

[root@centos7 ~]# mdadm -D /dev/md5

mdadm: cannot open /dev/md5: No such file or directory
Copy after login
(2) Enable raid device

[root@centos7 ~]# mdadm -A /dev/md5

mdadm: /dev/md5 has been started with 3 drives and 1 spare.
Copy after login
Check again and find that it has been started successfully

[root@centos7 ~]# cat /proc/mdstat

Personalities : [raid0] [raid6] [raid5] [raid4]
md5 : active raid5 sda8[0] sdc[3](S) sdb[4] sda9[1]
2095104 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
Copy after login

7 Simulate /dev/sdc damage

[root@centos7 ~]# mdadm /dev/md5 -f /dev/sdc

mdadm: set /dev/sdc faulty in /dev/md5
Copy after login

8 Remove /dev/sdc

[root@centos7 ~]# mdadm /dev/md5 -r /dev/sdc
mdadm: hot removed /dev/sdc from /dev/md5

[root@centos7 ~]# mdadm -D /dev/md5

/dev/md5:
[……]
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
[……]
Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
4 8 16 2 active sync /dev/sdb

可以看到已经移除成功。
Copy after login
Let’s look at the disk situation again

[root@centos7 ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 20G 0 disk
[……]
├─sda8 8:8 0 1G 0 part
│ └─md5 9:5 0 2G 0 raid5
└─sda9 8:9 0 1G 0 part
└─md5 9:5 0 2G 0 raid5
sdb 8:16 0 1G 0 disk
└─md5 9:5 0 2G 0 raid5
sdc 8:32 0 1G 0 disk
sr0 11:0 1 7.7G 0 rom
Copy after login
You can see that /dev/sdc no longer belongs to the md5 array

9Add to raid member

[root@centos7 ~]# mdadm /dev/md5 -a /dev/sdc

mdadm: added /dev/sdc
Copy after login
[root@centos7 ~]# mdadm -D /dev/md5

/dev/md5:
[……]
Raid Devices : 3
Total Devices : 4
Active Devices : 3
Working Devices : 4
[……]
Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
4 8 16 2 active sync /dev/sdb

3 8 32 - spare /dev/sdc
Copy after login
You can see that the addition was successful

10 Increase the number of raid members from 3 to 4

Add device /dev/sdd to the array here

[root@centos7 ~]# mdadm -G /dev/md5 -n 4 -a /dev/sdd

mdadm: added /dev/sdd
mdadm: Need to backup 3072K of critical section..
Copy after login
Check the file System integrity

[root@centos7 ~]# e2fsck -f /dev/md5

e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/md5: 11/131072 files (0.0% non-contiguous), 17964/523776 blocks
Copy after login
Synchronize the file system

[root@centos7 ~]# resize2fs /dev/md5

resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/md5 to 785664 (4k) blocks.
The filesystem on /dev/md5 is now 785664 blocks long.
Copy after login
Let’s check the /dev/md5 array again

[root@centos7 ~]# mdadm -D /dev/md5

/dev/md5:
Version : 1.2
Creation Time : Tue Apr 25 14:38:54 2017
Raid Level : raid5
Array Size : 3142656 (3.00 GiB 3.22 GB)
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB)
Raid Devices : 4
Total Devices : 5
Persistence : Superblock is persistent

Update Time : Tue Apr 25 15:13:32 2017
State : clean
Active Devices : 4
Working Devices : 5

Failed Devices : 0
Spare Devices : 1 

Layout : left-symmetric
Chunk Size : 512K

Name : centos7.3.loacl:5 (local to host centos7.3.loacl)
UUID : 5ec4115c:ab1e25c8:ff36d8a2:74f6fd8a
Events : 47

Number Major Minor RaidDevice State
0 8 8 0 active sync /dev/sda8
1 8 9 1 active sync /dev/sda9
4 8 16 2 active sync /dev/sdb
5 8 48 3 active sync /dev/sdd

3 8 32 - spare /dev/sdc
Copy after login

The above is the detailed content of Detailed explanation of the implementation of software raid 5. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What software is bonjour and can it be uninstalled? What software is bonjour and can it be uninstalled? Feb 20, 2024 am 09:33 AM

Title: Explore the Bonjour software and how to uninstall it Abstract: This article will introduce the functions, scope of use and how to uninstall the Bonjour software. At the same time, it will also be explained how to use other tools to replace Bonjour to meet the needs of users. Introduction: Bonjour is a common software in the field of computer and network technology. Although this may be unfamiliar to some users, it can be very useful in some specific situations. If you happen to have Bonjour software installed but now want to uninstall it, then

What software is crystaldiskmark? -How to use crystaldiskmark? What software is crystaldiskmark? -How to use crystaldiskmark? Mar 18, 2024 pm 02:58 PM

CrystalDiskMark is a small HDD benchmark tool for hard drives that quickly measures sequential and random read/write speeds. Next, let the editor introduce CrystalDiskMark to you and how to use crystaldiskmark~ 1. Introduction to CrystalDiskMark CrystalDiskMark is a widely used disk performance testing tool used to evaluate the read and write speed and performance of mechanical hard drives and solid-state drives (SSD). Random I/O performance. It is a free Windows application and provides a user-friendly interface and various test modes to evaluate different aspects of hard drive performance and is widely used in hardware reviews

What to do if WPS Office cannot open the PPT file - What to do if WPS Office cannot open the PPT file What to do if WPS Office cannot open the PPT file - What to do if WPS Office cannot open the PPT file Mar 04, 2024 am 11:40 AM

Recently, many friends have asked me what to do if WPSOffice cannot open PPT files. Next, let us learn how to solve the problem of WPSOffice not being able to open PPT files. I hope it can help everyone. 1. First open WPSOffice and enter the homepage, as shown in the figure below. 2. Then enter the keyword "document repair" in the search bar above, and then click to open the document repair tool, as shown in the figure below. 3. Then import the PPT file for repair, as shown in the figure below.

Corsair iCUE software not detecting RAM [Fixed] Corsair iCUE software not detecting RAM [Fixed] Feb 19, 2024 am 11:48 AM

This article will explore what users can do when the CorsairiCUE software does not recognize the RAM in a Windows system. Although the CorsairiCUE software is designed to let users control their computer's RGB lighting, some users have found that the software does not function properly, resulting in an inability to detect RAM modules. Why doesn't ICUE pick up my memory? The main reason why ICUE cannot correctly identify RAM is usually related to background software conflicts. In addition, incorrect SPD write settings may also cause this problem. Fixed issue with CorsairIcue software not detecting RAM If CorsairIcue software is not detecting RAM on your Windows computer, please use the following suggestions.

CrystalDiskinfo usage tutorial-What software is CrystalDiskinfo? CrystalDiskinfo usage tutorial-What software is CrystalDiskinfo? Mar 18, 2024 pm 04:50 PM

CrystalDiskInfo is a software used to check computer hardware devices. In this software, we can check our own computer hardware, such as reading speed, transmission mode, interface, etc.! So in addition to these functions, how to use CrystalDiskInfo and what exactly is CrystalDiskInfo? Let me sort it out for you! 1. The Origin of CrystalDiskInfo As one of the three major components of a computer host, a solid-state drive is the storage medium of a computer and is responsible for computer data storage. A good solid-state drive can speed up file reading and affect consumer experience. When consumers receive new devices, they can use third-party software or other SSDs to

How to set the keyboard increment in Adobe Illustrator CS6 - How to set the keyboard increment in Adobe Illustrator CS6 How to set the keyboard increment in Adobe Illustrator CS6 - How to set the keyboard increment in Adobe Illustrator CS6 Mar 04, 2024 pm 06:04 PM

Many users are using the Adobe Illustrator CS6 software in their offices, so do you know how to set the keyboard increment in Adobe Illustrator CS6? Then, the editor will bring you the method of setting the keyboard increment in Adobe Illustrator CS6. Interested users can take a look below. Step 1: Start Adobe Illustrator CS6 software, as shown in the figure below. Step 2: In the menu bar, click the [Edit] → [Preferences] → [General] command in sequence. Step 3: The [Keyboard Increment] dialog box pops up, enter the required number in the [Keyboard Increment] text box, and finally click the [OK] button. Step 4: Use the shortcut key [Ctrl]

What kind of software is bonjour? Is it useful? What kind of software is bonjour? Is it useful? Feb 22, 2024 pm 08:39 PM

Bonjour is a network protocol and software launched by Apple for discovering and configuring network services within a local area network. Its main role is to automatically discover and communicate between devices connected in the same network. Bonjour was first introduced in the MacOSX10.2 version in 2002, and is now installed and enabled by default in Apple's operating system. Since then, Apple has opened up Bonjour's technology to other manufacturers, so many other operating systems and devices can also support Bonjour.

How to resolve an incompatible software attempt to load with Edge? How to resolve an incompatible software attempt to load with Edge? Mar 15, 2024 pm 01:34 PM

When we use the Edge browser, sometimes incompatible software attempts to be loaded together, so what is going on? Let this site carefully introduce to users how to solve the problem of trying to load incompatible software with Edge. How to solve an incompatible software trying to load with Edge Solution 1: Search IE in the start menu and access it directly with IE. Solution 2: Note: Modifying the registry may cause system failure, so operate with caution. Modify registry parameters. 1. Enter regedit during operation. 2. Find the path\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Micros

See all articles