msgbartop
MAC OS X, Linux, Windows and other IT Tips and Tricks
msgbarbottom

18 Jan 16 Reporting SMART status of RAID disks

Reference site: //www.cyberciti.biz/faq/linux-checking-sas-sata-disks-behind-adaptec-raid-controllers/

Note: Although Hardware RAID controllers made by other hardware manufacturers here I use Adaptec as an example:

Install the software:
apt- get install smartmontools
Curious which company the RAID controller is from?
Find out which RAID controller you have:
lspci | grep 'RAID'
Result: 01:00.0 RAID bus controller: Adaptec Device 028b (rev 01)
# Check out if the controller is supported and which devices it sees:
smartctl --scan
Example output:
/dev/sda -d scsi [SCSI]
/dev/sdb -d scsi [SCSI]

Check the SMART overall-health test of the drives :
smartctl -d scsi -H /dev/sda | grep 'SMART'
smartctl -d scsi -H /dev/sdb | grep 'SMART'

Result example:
/dev/sda: SMART Health Status: OK
/dev/sdb: SMART Health Status: OK

Checking Individual drives behind the RAID controller
The individual drives behind the controller are usually named sequentially according to the order of the simulated drives:
eg.
/dev/sda (2 drives behind controller): /dev/sg1 /dev/sg2
/dev/sdb (2 drives behind controller): /dev/sg3 /dev/sg4

Commands for doing those checks:
smartctl -d scsi --all -T permissive /dev/sg1
smartctl -d scsi --all -T permissive /dev/sg2
smartctl -d scsi --all -T permissive /dev/sg3
smartctl -d scsi --all -T permissive /dev/sg4

Create a script that will be run by cron regularly and send the results by email:
Script:
#!/bin/bash
# Name: SMART-report.sh
# Purpose: Sends report of SMART status of RAID hard disks
# Syntax: SMART-report.sh
#--------------------------------------------------------
(. ~/.bashrc
echo -n "/dev/sda: "
smartctl -d scsi -H /dev/sda | grep 'SMART'
echo -n "/dev/sdb: "
smartctl -d scsi -H /dev/sdb | grep SMART
echo "Individual drives behind the RAID controller";echo
echo "============== /dev/sda ===> /dev/sg1 ============="
smartctl -d scsi --all -T permissive /dev/sg1 | grep 'SMART';echo
echo "============== /dev/sda ===> /dev/sg2 ============="
smartctl -d scsi --all -T permissive /dev/sg2 | grep 'SMART';echo
echo "============== /dev/sdb ===> /dev/sg3 ============="
smartctl -d scsi --all -T permissive /dev/sg3 | grep 'SMART';echo
echo "============== /dev/sdb ===> /dev/sg4 ============="
smartctl -d scsi --all -T permissive /dev/sg4 | grep 'SMART'
) | mail -s "SMART Result of $(hostname -f)" user@my-email.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: