The current status of a Linux software raid is written to the file /proc/mdstat. You can view the status on the shell with the command:
cat /proc/mdstat
The output will look similar to this:
server:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md2 : active raid1 sda3[0] sdb3[1]
726266432 blocks [2/2] [UU]
md1 : active (auto-read-only) raid1 sda2[0] sdb2[1]
4200896 blocks [2/2] [UU]
resync=PENDING
md0 : active raid1 sda1[0] sdb1[1]
2104448 blocks [2/2] [UU]
The above setup is a raid 1 system, this means that the data is mirrored to both disks. If one disk would have failed, you would see [_U] when the first disk has failed or [U_] when the second disk has failed in the output instead of [UU].
I extended this to an Administrator only page in Drupal using PHP input format. This way I can see the status from any browser without having to run putty or other terminal program. The header command refreshes the page every 5 minutes and the output of the mdstat can be styled by using CSS on the div.
<?php
header( 'refresh: 300; url=/sensors/' );
echo '’;
$raidStat = shell_exec(“cat /proc/mdstat”);
echo “RAID Status (mdstat):
“;
echo ”;
?>
Code a bit messy above.
[code]
<?php
header( 'refresh: 300; url=/sensors/' );
echo '’;
$raidStat = shell_exec(“cat /proc/mdstat”);
echo “RAID Status (mdstat):
“;
echo ”;
?>
[/code]