2024年【mdadm】Linux系统软RAID的创建方法_mdadm ssd cache(1)

[root@localhost ~]# fdisk -l sdb # 列出指定磁盘分区表
fdisk: 打不开 sdb: 没有那个文件或目录
[root@localhost ~]# fdisk -l /dev/sdb

磁盘 /dev/sdb:1073 MB, 1073741824 字节,2097152 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x155d620b

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 2097151 1047552 fd Linux raid autodetect

即可看到硬盘被分为一个主分区,类型为raid


同样对`sdc`到`sdf`剩下的磁盘进行一样的操作。


#### 简版步骤


**`fdisk /dev/sd[编号]`–>`n`(新建分区)–>`p`(主分区)–>`回车`(分区号默认1)–>`回车`(起始扇区默认2028)–>`回车`(大小默认)–>`t`(更改分区系统ID)–>`fd`(Linux raid 自动)–>`w`保存退出。**


#### 修改完分区表信息


修改完后,`sdb`到`sdf`信息如下。



[root@localhost ~]# fdisk -l /dev/sd[b-f]

磁盘 /dev/sdb:1073 MB, 1073741824 字节,2097152 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x155d620b

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 2097151 1047552 fd Linux raid autodetect

磁盘 /dev/sdc:1073 MB, 1073741824 字节,2097152 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x4efd7c63

设备 Boot Start End Blocks Id System
/dev/sdc1 2048 2097151 1047552 fd Linux raid autodetect

磁盘 /dev/sdd:1073 MB, 1073741824 字节,2097152 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x6320f4f2

设备 Boot Start End Blocks Id System
/dev/sdd1 2048 2097151 1047552 fd Linux raid autodetect

磁盘 /dev/sde:1073 MB, 1073741824 字节,2097152 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x9f1031c0

设备 Boot Start End Blocks Id System
/dev/sde1 2048 2097151 1047552 fd Linux raid autodetect

磁盘 /dev/sdf:1073 MB, 1073741824 字节,2097152 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x88fb5cf3

设备 Boot Start End Blocks Id System
/dev/sdf1 2048 2097151 1047552 fd Linux raid autodetect


### 安装mdadm


madam是Linux下的raid管理工具



[root@localhost ~]# yum install mdadm -y


#### mdadm帮助



[root@localhost ~]# mdadm --help
mdadm is used for building, managing, and monitoring
Linux md devices (aka RAID arrays)
Usage: mdadm --create device options…
Create a new array from unused devices. # 使用空闲的设备创建一个新阵列
mdadm --assemble device options…
Assemble a previously created array. # 组装之前创建的阵列
mdadm --build device options…
Create or assemble an array without metadata. # 创建或组装一个没有元数据的阵列
mdadm --manage device options…
make changes to an existing array. # 对现有阵列进行更改,比如增加热备磁盘或者设置某个磁盘失效,然后从阵列中删除这个磁盘
mdadm --misc options… devices
report on or modify various md related devices. # 报告或修改各种md相关设备,比如查询阵列或者设备的状态信息
mdadm --grow options device
resize/reshape an active array # 调整/重塑一个活动阵列,改变阵列中每个设备被使用的容量或阵列中的设备的数目
mdadm --incremental device
add/remove a device to/from an array as appropriate # 根据需要在阵列中添加/删除一个设备
mdadm --monitor options…
Monitor one or more array for significant changes. # 监视一个或多个阵列,查看是否有重大更改。
mdadm device options…
Shorthand for --manage.
Any parameter that does not start with ‘-’ is treated as a device name
or, for --examine-bitmap, a file name.
The first such name is often the name of an md device. Subsequent
names are often names of component devices.

For detailed help on the above major modes use --help after the mode
e.g.
mdadm --assemble --help
For general help on options use
mdadm --help-options
[root@localhost ~]# mdadm --help-options
Any parameter that does not start with ‘-’ is treated as a device name
or, for --examine-bitmap, a file name.
The first such name is often the name of an md device. Subsequent
names are often names of component devices.

Some common options are:
–help -h : General help message or, after above option,
mode specific help message
–help-options : This help message
–version -V : Print version information for mdadm
–verbose -v : Be more verbose about what is happening
–quiet -q : Don`t print un-necessary messages
–brief -b : Be less verbose, more brief
–export -Y : With --detail, --detail-platform or --examine use
key=value format for easy import into environment
–force -f : Override normal checks and be more forceful

–assemble -A : Assemble an array
–build -B : Build an array without metadata
–create -C : Create a new array
–detail -D : Display details of an array
–examine -E : Examine superblock on an array component
–examine-bitmap -X: Display the detail of a bitmap file
–examine-badblocks: Display list of known bad blocks on device
–monitor -F : monitor (follow) some arrays
–grow -G : resize/ reshape and array
–incremental -I : add/remove a single device to/from an array as appropriate
–query -Q : Display general information about how a
device relates to the md driver
–auto-detect : Start arrays auto-detected by the kernel


### 创建阵列


#### 创建阵列帮助



[root@localhost ~]# mdadm -C --help
Usage: mdadm --create device --chunk=X --level=Y --raid-devices=Z devices

Options that are valid with --create (-C) are:
–bitmap= -b : Create a bitmap for the array with the given filename
: or an internal bitmap if ‘internal’ is given
–chunk= -c : chunk size in kibibytes
–rounding= : rounding factor for linear array (==chunk size)
–level= -l : raid level: 0,1,4,5,6,10,linear,multipath and synonyms
–parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric
–layout= : same as --parity, for RAID10: [fno]NN
–raid-devices= -n : number of active devices in array
–spare-devices= -x : number of spare (eXtra) devices in initial array
–size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional
–data-offset= : Space to leave between start of device and start
: of array data.
–force -f : Honour devices as listed on command line. Don`t
: insert a missing drive for RAID5.
–run -R : insist of running the array even if not all
: devices are present or some look odd.
–readonly -o : start the array readonly - not supported yet.
–name= -N : Textual name for array - max 32 characters
–bitmap-chunk= : bitmap chunksize in Kilobytes.
–delay= -d : bitmap update delay in seconds.
–write-journal= : Specify journal device for RAID-4/5/6 array
–consistency-policy= : Specify the policy that determines how the array
-k : maintains consistency in case of unexpected shutdown.


#### 创建raid5


**`mdadm -C /dev/md0 -l5 -n4 -x1 /dev/sd[b-f]1`**



[root@localhost ~]# mdadm --create /dev/md0 --level=5 --raid-devices=4 --spare-devices=1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

简写

[root@localhost ~]# mdadm -C /dev/md0 -l5 -n4 -x1 /dev/sd[b-f]1


#### 查看阵列详情


**`mdadm -D /dev/md0`**



[root@localhost ~]# fdisk -l /dev/md0

磁盘 /dev/md0:3211 MB, 3211788288 字节,6273024 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):524288 字节 / 1572864 字节

查看阵列详情

[root@localhost ~]# mdadm --detail /dev/md0
[root@localhost ~]# mdadm -D /dev/md0 # 简写
/dev/md0: # raid设备文件名
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020 # 创建时间
Raid Level : raid5 # raid等级
Array Size : 3136512 (2.99 GiB 3.21 GB) # raid可用磁盘大小
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB) # 每个磁盘可用容量
Raid Devices : 4 # 用做raid的磁盘数量
Total Devices : 5 # 全部磁盘数量
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 09:18:26 2020
         State : clean 
Active Devices : 4  # 激活raid磁盘数量

Working Devices : 5 # 可工作磁盘数量
Failed Devices : 0 # 故障磁盘数量
Spare Devices : 1 # 热备磁盘数量

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b  # 此设备(raid)的标识符
        Events : 18

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1  # 阵列磁盘
   1       8       33        1      active sync   /dev/sdc1
   2       8       49        2      active sync   /dev/sdd1
   5       8       65        3      active sync   /dev/sde1

   4       8       81        -      spare   /dev/sdf1  # 热备磁盘

还可以通过下面的文件来查看系统软件磁盘阵列的情况

[root@localhost ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sde1[5] sdf14 sdd1[2] sdc1[1] sdb1[0]

md0使用了raid5,S为热备盘,其他表示阵列硬盘

  3136512 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
  # 3136512个block(每个block单位为1k),所以总容量约为3.21GB。
  # 使用raid5等级,写入磁盘的小区块(chunk)大小为512k,使用algorithm 2磁盘阵列算法。
  # [m/n]代表此数组需要m个设备,且n个设备是正常运行的。因此本md0需要4个设备且这4个设备正常运行。
  # 后面的[UUUU]代表的是四个所需的设备启动情况。U代表正常运作。若为\_则代表不正常。

unused devices:


#### 格式化与挂载使用raid


**`mkfs -t ext3 /dev/md0`**



[root@localhost ~]# mkfs
用法:
mkfs [选项] [-t <类型>] [文件系统选项] <设备> [<大小>]

选项:
-t, --type=<类型> 文件系统类型;若不指定,将使用 ext2
fs-options 实际文件系统构建程序的参数
<设备> 要使用设备的路径
<大小> 要使用设备上的块数
-V, --verbose 解释正在进行的操作;
多次指定 -V 将导致空运行(dry-run)
-V, --version 显示版本信息并退出
将 -V 作为 --version 选项时必须是惟一选项
-h, --help 显示此帮助并退出

更多信息请参阅 mkfs(8)。


使用mkfs格式化md0



[root@localhost ~]# mkfs -t ext3 /dev/md0
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=128 blocks, Stripe width=384 blocks
196224 inodes, 784128 blocks
39206 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成


创建挂载点,并将md0挂载



[root@localhost ~]# mkdir /mnt/raid5

挂载

[root@localhost ~]# mount /dev/md0 /mnt/raid5/

查看分区信息

[root@localhost ~]# df -h /mnt/raid5/
文件系统 容量 已用 可用 已用% 挂载点
/dev/md0 2.9G 4.6M 2.8G 1% /mnt/raid5


#### 开机启动raid并自动挂载


设置开机启动raid



获取设备md0的UUID

[root@localhost ~]# mdadm -D /dev/md0 | grep -i uuid
UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
[root@localhost ~]# vim /etc/mdadm.conf

修改mdadm默认的配置文件,没有就新增;新建配置文件,写入下面的内容

[root@localhost ~]# cat /etc/mdadm.conf
ARRAY /dev/md0 UUID=9e591745:7b4f4aa8:94168959:fc32ba2b


设置自动挂载



[root@localhost ~]# vim /etc/fstab

编辑fstab文件,添加下面的行

[root@localhost ~]# cat /etc/fstab | grep md0
/dev/md0 /mnt/raid5 ext3 defaults 0 0


测试reboot后挂载请况



重启后查看

[root@localhost ~]# df -h /dev/md0
文件系统 容量 已用 可用 已用% 挂载点
/dev/md0 2.9G 4.6M 2.8G 1% /mnt/raid5


### 模拟raid错误


在raid分区中随意添加一些文件



[root@localhost ~]# cd /mnt/raid5/
[root@localhost raid5]# touch a.sh
[root@localhost raid5]# touch b.py
[root@localhost raid5]# mkdir d
[root@localhost raid5]# ll
总用量 20
-rw-r–r–. 1 root root 0 3月 4 10:29 a.sh
-rw-r–r–. 1 root root 0 3月 4 10:29 b.py
drwxr-xr-x. 2 root root 4096 3月 4 10:29 d
drwx------. 2 root root 16384 3月 4 09:47 lost+found


#### 管理阵列帮助



[root@localhost ~]# mdadm --manage --help

Options that are valid with management mode are:
–add -a : hotadd subsequent devices to the array # 向阵列中添加参数指定的设备
–re-add : subsequent devices are re-added if there were
: recent members of the array
–remove -r : remove subsequent devices, which must not be active # 将参数指定的空闲设备从阵列中移出去
–fail -f : mark subsequent devices a faulty # 将参数指定的设备标记为出错状态
–set-faulty : same as --fail
–replace : mark device(s) to be replaced by spares. Once
: replacement completes, device will be marked faulty
–with : Indicate which spare a previous ‘–replace’ should
: prefer to use
–run -R : start a partially built array
–stop -S : deactivate array, releasing all resources
–readonly -o : mark array as readonly
–readwrite -w : mark array as readwrite


#### 模拟标记错误硬盘


**`mdadm --manage /dev/md0 --fail /dev/sdd1`**



当前阵列状态

[root@localhost ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 5
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 10:29:50 2020
         State : clean 
Active Devices : 4

Working Devices : 5
Failed Devices : 0
Spare Devices : 1

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 20

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   1       8       33        1      active sync   /dev/sdc1
   2       8       49        2      active sync   /dev/sdd1
   5       8       65        3      active sync   /dev/sde1

   4       8       81        -      spare   /dev/sdf1

标记错误磁盘

[root@localhost ~]# mdadm --manage /dev/md0 --fail /dev/sdd1
mdadm: set /dev/sdd1 faulty in /dev/md0

查看状态

[root@localhost ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 5
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 10:41:38 2020
         State : clean 
Active Devices : 4

Working Devices : 4
Failed Devices : 1
Spare Devices : 0

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 39

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   1       8       33        1      active sync   /dev/sdc1
   4       8       81        2      active sync   /dev/sdf1
   5       8       65        3      active sync   /dev/sde1

   2       8       49        -      faulty   /dev/sdd1

标记错误磁盘后



Active Devices : 4 -> 4

Working Devices : 5 -> 4
Failed Devices : 0 -> 1
Spare Devices : 1 -> 0


说明某一块磁盘失效后,不会影响raid5的功能,并且`spare`的磁盘会自动加入到raid中,然后失效磁盘会被标记为`faulty`。并且资料无损是。



[root@localhost ~]# ls -l /mnt/raid5/
总用量 20
-rw-r–r–. 1 root root 0 3月 4 10:29 a.sh
-rw-r–r–. 1 root root 0 3月 4 10:29 b.py
drwxr-xr-x. 2 root root 4096 3月 4 10:29 d
drwx------. 2 root root 16384 3月 4 09:47 lost+found


#### 移除错误硬盘


**`mdadm --manage /dev/md0 --remove /dev/sdd1`**  
 移除已损坏的磁盘,添加一块新硬盘作为热备盘



模拟移除故障盘

[root@localhost ~]# mdadm --manage /dev/md0 --remove /dev/sdd1
mdadm: hot removed /dev/sdd1 from /dev/md0
[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 10:50:09 2020
         State : clean 
Active Devices : 4

Working Devices : 4
Failed Devices : 0
Spare Devices : 0

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 40

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   1       8       33        1      active sync   /dev/sdc1
   4       8       81        2      active sync   /dev/sdf1
   5       8       65        3      active sync   /dev/sde1

可以看到故障盘已被移除


#### 添加新硬盘


**`mdadm --manage /dev/md0 --add /dev/sdd1`**  
 为了方便,不在新增磁盘或者分区,直接使用移除的分区重新添加。**在实际环境中sdd1已经是另一块完好的硬盘了**。



更换一块硬盘并加入到阵列热备盘中

[root@localhost ~]# mdadm --manage /dev/md0 --add /dev/sdd1
mdadm: added /dev/sdd1
[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 5
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 10:54:08 2020
         State : clean 
Active Devices : 4

Working Devices : 5
Failed Devices : 0
Spare Devices : 1

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 41

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   1       8       33        1      active sync   /dev/sdc1
   4       8       81        2      active sync   /dev/sdf1
   5       8       65        3      active sync   /dev/sde1

   6       8       49        -      spare   /dev/sdd1

### 测试阵列添加多块热备


#### 添加磁盘sdg1



[root@localhost ~]# fdisk /dev/sd
sda sda1 sda2 sdb sdb1 sdc sdc1 sdd sdd1 sde sde1 sdf sdf1 sdg
[root@localhost ~]# fdisk /dev/sdg
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x8a6fb4d2 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-2097151,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-2097151,默认为 2097151):
将使用默认值 2097151
分区 1 已设置为 Linux 类型,大小设为 1023 MiB

命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。


#### sdg1添加到阵列(2块热备)



[root@localhost ~]# mdadm --manage /dev/md0 --add /dev/sdg1
mdadm: added /dev/sdg1
[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 6
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 11:28:20 2020
         State : clean 
Active Devices : 4

Working Devices : 6
Failed Devices : 0
Spare Devices : 2

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 42

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   1       8       33        1      active sync   /dev/sdc1
   4       8       81        2      active sync   /dev/sdf1
   5       8       65        3      active sync   /dev/sde1

   6       8       49        -      spare   /dev/sdd1
   7       8       97        -      spare   /dev/sdg1

#### sdc1标记错误(降级恢复,剩1块热备)



[root@localhost ~]# mdadm --manage /dev/md0 --fail /dev/sdc1
mdadm: set /dev/sdc1 faulty in /dev/md0
[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 6
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 11:29:34 2020
         State : clean, degraded, recovering 
Active Devices : 3

Working Devices : 5
Failed Devices : 1
Spare Devices : 2

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

Rebuild Status : 90% complete

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 58

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   7       8       97        1      spare rebuilding   /dev/sdg1
   4       8       81        2      active sync   /dev/sdf1
   5       8       65        3      active sync   /dev/sde1

   1       8       33        -      faulty   /dev/sdc1
   6       8       49        -      spare   /dev/sdd1

[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 6
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 11:29:35 2020
         State : clean 
Active Devices : 4

Working Devices : 5
Failed Devices : 1
Spare Devices : 1

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 61

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   7       8       97        1      active sync   /dev/sdg1
   4       8       81        2      active sync   /dev/sdf1
   5       8       65        3      active sync   /dev/sde1

   1       8       33        -      faulty   /dev/sdc1
   6       8       49        -      spare   /dev/sdd1

#### sde1标记错误(降级恢复,剩0块热备)



[root@localhost ~]# mdadm --manage /dev/md0 --fail /dev/sde1
mdadm: set /dev/sde1 faulty in /dev/md0
[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 6
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 11:31:33 2020
         State : clean, degraded, recovering 
Active Devices : 3

Working Devices : 4
Failed Devices : 2
Spare Devices : 1

        Layout : left-symmetric
    Chunk Size : 512K

Consistency Policy : resync

Rebuild Status : 57% complete

          Name : localhost.localdomain:0  (local to host localhost.localdomain)
          UUID : 9e591745:7b4f4aa8:94168959:fc32ba2b
        Events : 72

Number   Major   Minor   RaidDevice State
   0       8       17        0      active sync   /dev/sdb1
   7       8       97        1      active sync   /dev/sdg1
   4       8       81        2      active sync   /dev/sdf1
   6       8       49        3      spare rebuilding   /dev/sdd1

   1       8       33        -      faulty   /dev/sdc1
   5       8       65        -      faulty   /dev/sde1

[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Mar 4 09:18:20 2020
Raid Level : raid5
Array Size : 3136512 (2.99 GiB 3.21 GB)
Used Dev Size : 1045504 (1021.00 MiB 1070.60 MB)
Raid Devices : 4
Total Devices : 6
Persistence : Superblock is persistent

   Update Time : Wed Mar  4 11:31:36 2020
         State : clean 
Active Devices : 4

最全的Linux教程,Linux从入门到精通

======================

  1. linux从入门到精通(第2版)

  2. Linux系统移植

  3. Linux驱动开发入门与实战

  4. LINUX 系统移植 第2版

  5. Linux开源网络全栈详解 从DPDK到OpenFlow

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

第一份《Linux从入门到精通》466页

====================

内容简介

====

本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。

需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以点击这里获取!

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 10
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值