当前位置:网站首页>Creation of raid0 and RAID5 and Simulation of how RAID5 works
Creation of raid0 and RAID5 and Simulation of how RAID5 works
2022-04-23 09:20:00 【King_ nul】
RAID0 and RAID5 Create process and simulation RAID5 working principle
summary :
raid0:raid0 yes raid The lowest level in the disk array , The principle is to speed up the writing speed by dividing the data and writing data to two disks at the same time , Data is easy to be lost after the disk is damaged .
raid1:raid1 It's called disk mirroring , The principle is to mirror the data from one disk to another , That is, data is written to a disk at the same time , A mirror file is generated on another idle disk , Disk availability is only half of the total disk capacity . Provides data security, but reduces disk availability .
raid5:raid5( The independent disk structure of distributed parity ), Use at least three disks , Split the data and write it to disk , And there are parity codes on each disk , When a disk goes wrong , After replacing the disk , Use the check codes of other disks to recover data .
RAID0 experiment
# Use two hard disks to make RAID0 Disk array
[root@centos7 ~]# mdadm -Cv /dev/md0 -l 0 -n 2 /dev/sd[b,c]
mdadm: chunk size defaults to 512K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
# Format disk array
[root@centos7 ~]# mkfs.xfs /dev/md0
meta-data=/dev/md0 isize=512 agcount=16, agsize=654720 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=10475520, imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=5120, version=2
= sectsz=512 sunit=8 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
# Create mount directory raid0
[root@centos7 ~]# mkdir /mnt/raid0
[root@centos7 ~]# mount /dev/md0 /mnt/raid0/
[root@centos7 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 899M 0 899M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 9.6M 901M 2% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 17G 1.6G 16G 9% /
/dev/sda1 xfs 1014M 194M 821M 20% /boot
tmpfs tmpfs 182M 0 182M 0% /run/user/0
/dev/md0 xfs 40G 33M 40G 1% /mnt/raid0
# see RAID0 Information and configure automatic mount after startup
[root@centos7 ~]# echo "UUID=c8c19587-719d-44be-b5f3-cfebf946b049 /raid0 xfs defaults 0 0">>/
etc/fstab
[root@centos7 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Mar 26 17:01:57 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=312ce7b8-226c-4f10-9f5f-3746c22e0380 /boot xfs defaults,uquota 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
UUID=c8c19587-719d-44be-b5f3-cfebf946b049 /raid0 xfs defaults 0 0
#raid0 Disk array creation completed
RAID5 experiment
# add to 4 Block hard disk , Use 3 A hard disk array ,1 A hard disk as a backup disk
[root@centos7 ~]# mdadm -Cv /dev/md5 -a yes -l 5 -n 3 /dev/sd[b,c,d] --spare-devices=1 /dev/sde
# Check the disk mount
[root@centos7 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 899M 0 899M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 9.6M 901M 2% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 17G 1.6G 16G 9% /
/dev/sda1 xfs 1014M 194M 821M 20% /boot
tmpfs tmpfs 182M 0 182M 0% /run/user/0
/dev/md5 xfs 40G 33M 40G 1% /mnt/raid5
# Configure boot auto mount
[root@centos7 ~]# echo "UUID=c8c19587-719d-44be-b5f3-cfebf946b049 /raid5 xfs defaults 0 0">> /etc/fstab
[root@centos7 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Mar 26 17:01:57 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=312ce7b8-226c-4f10-9f5f-3746c22e0380 /boot xfs defaults,uquota 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
UUID=c8c19587-719d-44be-b5f3-cfebf946b049 /raid5 xfs defaults 0 0
# Test the operation of the backup disk , Simulated disk corruption
[root@centos7 ~]# mdadm -D /dev/md5
/dev/md5:
Version : 1.2
Creation Time : Mon Apr 5 20:38:12 2021
Raid Level : raid5
Array Size : 41908224 (39.97 GiB 42.91 GB)
Used Dev Size : 20954112 (19.98 GiB 21.46 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Mon Apr 5 20:44:13 2021
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : resync
Name : centos7:5 (local to host centos7)
UUID : 34c23472:a07b39ef:f9e5aceb:9cb85199
Events : 18
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
4 8 48 2 active sync /dev/sdd
3 8 64 - spare /dev/sde
[root@centos7 ~]# mdadm -f /dev/md5 /dev/sdd
mdadm: set /dev/sdd faulty in /dev/md5
[root@centos7 ~]# mdadm -D /dev/md5
/dev/md5:
Version : 1.2
Creation Time : Mon Apr 5 20:38:12 2021
Raid Level : raid5
Array Size : 41908224 (39.97 GiB 42.91 GB)
Used Dev Size : 20954112 (19.98 GiB 21.46 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Mon Apr 5 20:51:14 2021
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 1
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : resync
Rebuild Status : 7% complete
Name : centos7:5 (local to host centos7)
UUID : 34c23472:a07b39ef:f9e5aceb:9cb85199
Events : 21
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
3 8 64 2 spare rebuilding /dev/sde
4 8 48 - faulty /dev/sdd
# Simulation complete
版权声明
本文为[King_ nul]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230629527469.html
边栏推荐
- Notes on xctf questions
- Base de la technologie électronique numérique 3.1 aperçu du circuit de porte, 3.2 circuit de porte à diode semi - conductrice
- ALV树(LL LR RL RR)插入删除
- To remember the composition ~ the pre order traversal of binary tree
- Thread scheduling (priority)
- EmuElec 编译总结
- DMP engine work summary (2021, lightsaber)
- Brush classic topics
- JS prototype chain
- Summary of wrong questions 1
猜你喜欢
Principle of synchronized implementation
Go language learning notes - slice, map | go language from scratch
Go language learning notes - language interface | go language from scratch
Harbor enterprise image management system
Leetcode-199 - right view of binary tree
node安装
SAP 101K 411k inventory change
A must see wechat applet development guide 1 - basic knowledge
501. 二叉搜索树中的众数
112. Path sum
随机推荐
JS prototype chain
Go language learning notes - array | go language from scratch
【读书笔记】《Verilog数字系统设计教程》 第5章 条件语句、循环语句和块语句(附思考题答案)
About CIN, scanf and getline, getchar, CIN Mixed use of getline
First principle mind map
Flink reads MySQL and PgSQL at the same time, and the program will get stuck without logs
Go language learning notes - slice, map | go language from scratch
Kettle experiment
653. Sum of two IV - input BST
[original] use system Text. JSON formats the JSON string
LeetCode_ DFS_ Medium_ 1254. Count the number of closed islands
Kettle experiment (III)
Data visualization: use Excel to make radar chart
Multi view depth estimation by fusing single view depth probability with multi view geometry
How to protect open source projects from supply chain attacks - Security Design (1)
小女孩行走
Pctp test experience sharing
RSA encryption and decryption signature verification
错题汇总1
考研线性代数常见概念、问题总结