标签:多个 pen mke2fs -- nal speed sans comm 更换
介绍raid类型,以及配置软raid
RAID全称为: Redundant Array Inexpensive Disks
将多个磁盘组合成阵列,提供更好的性能和冗余能力
-A: 装配模式,重新识别此前实现的RAID
-C:创建模式,创建RAID
-F:监控模式
管理模式:-f, -r, -a
-C: 创建模式中专用选项
-n #: 用于创建RAID设备的磁盘个数;
-l #: 级别
-a yes: 自动为创建的RAID生成设备文件;
-c Chunk_Size:
cat /proc/mdstat
1. 显示指定的软RAID的详细信息
mdadm -D /dev/md#
2. 将/dev/md#中的/dev/some_device手动设置为损坏
mdadm /dev/md# -f /dev/some_device
3. 新增设备
mdadm /dev/md# -a /dev/new_device
4. 停止软raid
mdadm -S /dev/md#
5. 重新启用RAID
mdadm -A /dev/md# /dev/DEVICE...
6. mdadm的配置文件/etc/mdadm.conf
7. 阶段性地执行指定的COMMAND
watch [-n #] <COMMAND>:
创建一个可用空间为10G的RAID5设备,要求其chunk大小为256K,文件系统为ext4,开机可自动挂载至/backup目录,支持acl功能;有一个空闲盘
1. 因为10G空间,而且有一个空闲盘,因此必须要有4块5G的分区,将物理硬盘创建为RAID设备
[root@backup ~]# mdadm -C /dev/md0 -a yes -n 3 -l 5 -x1 /dev/sdb{5..8}
mdadm: Fail create md0 when using /sys/module/md_mod/parameters/new_array
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@backup ~]# cat /proc/mdstat
Personalities : [raid10] [raid6] [raid5] [raid4]
md0 : active raid5 sdb7[4] sdb8[3](S) sdb6[1] sdb5[0]
10475520 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
[=======>.............] recovery = 38.2% (2001792/5237760) finish=0.2min speed=222421K/sec
2. 查看该raid设备
[root@backup ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jul 18 05:56:45 2019
Raid Level : raid5
Array Size : 10475520 (9.99 GiB 10.73 GB)
Used Dev Size : 5237760 (5.00 GiB 5.36 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Thu Jul 18 05:57:11 2019
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : resync
Name : backup:0 (local to host backup)
UUID : f22a4a54:6e782a63:2eab48e2:a838a28e
Events : 18
Number Major Minor RaidDevice State
0 8 21 0 active sync /dev/sdb5
1 8 22 1 active sync /dev/sdb6
4 8 23 2 active sync /dev/sdb7
3 8 24 - spare /dev/sdb
3. 创建文件系统,并写入/etc/fstab文件
[root@backup ~]# mke2fs -t ext4 /dev/md0
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
[root@backup ~]# tune2fs -L raid5 /dev/md0
[root@backup ~]# blkid /dev/md0
/dev/md0: LABEL="raid5" UUID="770842d3-89cb-40cc-8c96-7cbc8fd2c2b2" TYPE="ext4"
[root@backup ~]# echo "LABEL=raid5 /backup ext4 defaults,acl 0 0" >>/etc/fstab
4. 测试是否挂载成功
[root@backup ~]# mount -a
[root@backup ~]# df -h |grep "/backup"
/dev/md0 9.8G 37M 9.2G 1% /backup
[root@backup ~]# mdadm -f /dev/md0 /dev/sdb5
mdadm: set /dev/sdb5 faulty in /dev/md0
[root@backup ~]# mdadm -r /dev/md0 /dev/sdb5
mdadm: hot removed /dev/sdb5 from /dev/md0
更换好故障硬盘后执行
[root@backup ~]# mdadm -a /dev/md0 /dev/sdb5
mdadm: added /dev/sdb5
查看同步进度
[root@backup ~]# watch -n1 ‘cat /proc/mdstat‘
查看MD的状态
[root@backup ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jul 18 05:56:45 2019
Raid Level : raid5
Array Size : 10475520 (9.99 GiB 10.73 GB)
Used Dev Size : 5237760 (5.00 GiB 5.36 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
mdadm –S /dev/md0
mdadm --zero-superblock /dev/sdb1
mdadm –A –s /dev/md0 激活
mdadm –R /dev/md0
标签:多个 pen mke2fs -- nal speed sans comm 更换
原文地址:https://www.cnblogs.com/chacha51/p/11285421.html