[root@localhost ~]# mdadm --monitor --mail=root@localhost --program=/root/md.sh --syslog --delay=300 /dev/md0 --daemonise
3305
[root@localhost ~]# mdadm -f /dev/md0 /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0
[root@localhost ~]# mdadm -f /dev/md0 /dev/sd
sda sda1 sda2 sda3 sda4 sda5 sdb sdc sdd sde sdf sdg sdh sdi
[root@localhost ~]# mdadm -f /dev/md0 /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# mdadm -D /dev/md0
/dev/md0:
Version : 0.90
Creation Time : Thu Jun 27 21:54:21 2013
Raid Level : raid5
Array Size : 41942912 (40.00 GiB 42.95 GB)
Used Dev Size : 20971456 (20.00 GiB 21.47 GB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu Jun 27 22:03:48 2013
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 1
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 27% complete
UUID : c7b98767:dbe2c944:442069fc:23ae34d9
Events : 0.4
Number Major Minor RaidDevice State
3 8 64 0 spare rebuilding /dev/sde
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
4 8 16 - faulty spare /dev/sdb
[root@localhost ~]# tail –f /var/log/messages
Jun 27 22:03:48 localhost kernel: --- rd:3 wd:2 fd:1
Jun 27 22:03:48 localhost kernel: disk 0, o:1, dev:sde
Jun 27 22:03:48 localhost kernel: disk 1, o:1, dev:sdc
Jun 27 22:03:48 localhost kernel: disk 2, o:1, dev:sdd
Jun 27 22:03:48 localhost kernel: md: syncing RAID array md0
Jun 27 22:03:48 localhost kernel: md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
Jun 27 22:03:48 localhost kernel: md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
Jun 27 22:03:49 localhost kernel: md: using 128k window, over a total of 20971456 blocks.
Jun 27 22:03:48 localhost mdadm[3305]: RebuildStarted event detected on md device /dev/md0
Jun 27 22:03:49 localhost mdadm[3305]: Fail event detected on md device /dev/md0, component device /dev/sdb
[root@localhost ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 4 messages 4 new
>N 1 logwatch@localhost.l Wed Jun 12 03:37 43/1629 "Logwatch for localhost.localdomain (Linux)"
N 2 logwatch@localhost.l Wed Jun 12 04:02 43/1629 "Logwatch for localhost.localdomain (Linux)"
N 3 logwatch@localhost.l Thu Jun 27 17:58 43/1629 "Logwatch for localhost.localdomain (Linux)"
N 4 root@localhost.local Thu Jun 27 22:03 32/1255 "Fail event on /dev/md0:localhost.localdomain"
& 4
Message 4:
From root@localhost.localdomain Thu Jun 27 22:03:49 2013
Date: Thu, 27 Jun 2013 22:03:49 +0800
From: mdadm monitoring <root@localhost.localdomain>
To: root@localhost.localdomain
Subject: Fail event on /dev/md0:localhost.localdomain
This is an automatically generated mail message from mdadm
running on localhost.localdomain
A Fail event had been detected on md device /dev/md0.
It could be related to component device /dev/sdb.
Faithfully yours, etc.
P.S. The /proc/mdstat file currently contains the following:
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdd[2] sde[3] sdc[1] sdb[4](F)
41942912 blocks level 5, 64k chunk, algorithm 2 [3/2] [_UU]
[>....................] recovery = 0.9% (200064/20971456) finish=1.7min speed=200064K/sec
unused devices: <none>
&