Software RAID Status & Monitoring (Linux)

Source : https://www.ionos.com/help/server-cloud-infrastructure/linux-dedicated-server/rescue-and-recovery/software-raid-status-monitoring-linux/

For Dedicated Server Linux

You can read the status of the software RAID in the shell with the command cat /proc/mdstat.

Please note: All commands are exemplary and must be adapted accordingly!

First, an example of a status message if both disks are present and correctly mounted:

cat /proc/mdstat
bash
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 sda3[1] sdb3[0]
262016 blocks [2/2] [UU]

md1 : active raid1 sda2[1] sdb2[0]
119684160 blocks [2/2] [UU]

md0 : active raid1 sda1[1] sdb1[0]
102208 blocks [2/2] [UU]

unused devices: <none>
bash

The example shows three RAID arrays (md0, md1, md2). In the second line, the state of each partition is shown in square brackets at the end. A U means that the respective device is in order (up).

If a disk is missing (here sdb), the output looks similar to the following:

cat /proc/mdstat
bash
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 sda1[1]
102208 blocks [2/1] [_U]

md2 : active raid1 sda3[1]
262016 blocks [2/1] [_U]

md1 : active raid1 sda2[1]
119684160 blocks [2/1] [_U]

unused devices: <none>
bash

By[_U] you can see that something is wrong here.

Show details about RAID device

The command mdadm -D /dev/md1 provides detailed information about a RAID device

Here is an example of a working RAID:

mdadm -D /dev/md1
bash
/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
bash

If there is a missing disk, the output is similar to the following:

mdadm -D /dev/md0
bash
/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 : 0
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
bash

RAID monitoring

Mdadm can also be started as a demon. By adding the /etc/mdadm.conf file line

MAILADDR admin@meinedomain.de 
bash

is configured, an error message is sent by email in the event of a disk failure.

Example scenario:

The array should be checked every 300 seconds. If an event occurs, an email should be sent and the event noted in the system log file. The option --daemonise runs the monitoring program continuously in the background. So the command would look like this:

 ./mdadm --monitor --mail=root@localhost --syslog --delay=300 /dev/md0 --daemonise
bash
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to improve playback of lower-latency Apple HLS streams (Wowza)

In Wowza Streaming Engine Manager, click the Applications tab and then click live in the...

DirectAdmin: Improve performance and security

In this tutorial, I'm going to improve the DirectAdmin environment, make it faster and more...

Reverse DNS

Linux curl http://freedns.icez.net/rdns.php?hostname=xx.domain.com Windows Open Web Browser...

mysql optimize & repair all db

repair mysqlcheck --all-databases --auto-repair --silent -u root -p optimize mysqlcheck -u...

mysql restore & backup

restore mysql -u username -p dbname < /path/file.sql backup mysqldump -u username -p dbname...