For Linux Dedicated Servers
You can read the status of the software RAID in the shell with the command cat /proc/mdstat.
All commands shown below are examples and must be adapted accordingly!
First, an example of a status message when both disks are present and mounted correctly:
Personalities : [raid1] read_ahead 1024 sectors md2 : active raid1 sda3 sdb3 262016 blocks [2/2] [UU] md1 : active raid1 sda2 sdb2 119684160 blocks [2/2] [UU] md0 : active raid1 sda1 sdb1 102208 blocks [2/2] [UU] unused devices: <none>
The example shows three RAID arrays (md0, md1, md2). In the second line in each case, the state of the individual partitions is shown at the end in square brackets. A U means that the respective device is in order (up).
If a hard disk (here sdb) is missing, the output looks similar to the following:
Personalities : [raid1] read_ahead 1024 sectors md0 : active raid1 sda1 102208 blocks [2/1] [U_] md2 : active raid1 sda3 262016 blocks [2/1] [U_] md1 : active raid1 sda2 119684160 blocks [2/1] [U_] unused devices: <none>
You can tell from [U_] that something is wrong here.
Showing RAID Device Details
Detailed information about a RAID device is provided by the command mdadm -D /dev/md1.
Here is an example of a working RAID:
mdadm -D /dev/md1
/dev/md1: Version : 0.90 Creation Time : Tue Sep 11 21:33:24 2012 Raid Level : raid1 Array Size : 4194240 (4.00 GiB 4.29 GB) Used Dev Size : 4194240 (4.00 GiB 4.29 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Wed Jun 10 11:11:05 2015 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 UUID : 2db35cef:bde058e8:1f51fb89:78ee93fe Events : 0.251 Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 8 17 1 active sync /dev/sdb1
If the hard disk is missing, the output looks similar to the following:
mdadm -D /dev/md0
/dev/md0: Version : 00.90.00 Creation Time : Thu Aug 21 12:22:43 2003 Raid Level : raid1 Array Size : 102208 (99.81 MiB 104.66 MB) Device Size : 102208 (99.81 MiB 104.66 MB) Raid Devices : 2 Total Devices : 1 Preferred Minor : 0 Persistence : Superblock is persistent Update Time : Fri Oct 15 06:25:45 2004 State : dirty, no-errors Active Devices : 1 Working Devices : 1 Failed Devices : 1 Spare Devices : 0 Number Major Minor RaidDevice State 0 0 0 0 faulty removed 1 3 1 1 active sync /dev/sda1 UUID : f9401842:995dc86c:b4102b57:f2996278
Monitoring the RAID
Provided that you have configured your server's operating system to send emails, you can also have an error message sent to you by email in the event of a hard disk failure. For this purpose, start Mdadm as Deamon. Then, enter the following line in the file /etc/mdadm/mdadm.conf (Ubuntu) or /etc/mdadm.conf (CentOS 7):
MAILADDR email@example.comAll events are also logged in the /var/log/syslog directory.
You can use Postfix, for example, to send and receive emails. For instructions on how to configure Postfix to use an IONOS email account, please see the following article:
The array should be checked every 300 seconds. If an event occurs, an email is to be sent and the event is to be noted in the system log file. The --daemonise option makes the monitoring program run continuously in the background. Thus, the command would look like this:
./mdadm --monitor --mail=root@localhost --syslog --delay=300 /dev/md0 --daemonise