[SOLVED] Using smartd to periodically monitor hard disk's health
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Using smartd to periodically monitor hard disk's health
Hello,
I am trying to setup smartd on my slackware server to monitor the hard drives (7 of them) in case problems were to arise.
Slackware comes with smartmontools so no need to install smartctl or smartd. Basically, I want smartd to periodically (lets say every half hour or so) poll the drives and see if problems are found. If so, send an email to inform of the problems found. If no problems found, no email sent...
I am interested in overall health condition, temperature, temperature difference between polls, and all other info that should be verified.
TO be honest, I am not an expert at smartd so the command above *COULD* be incomplete, wrong or simply useless... Anybody could suggest a good overall command?
My second question is with the smart daemon itself. I tried to start it and it complained that SMART was not turned on on my drives... I tried to start SMART as suggested by smartd with smart -s on /dev/sdX but it failed....
The output in the terminal from smartd:
Code:
bash-4.1# smartd -d
smartd 5.39.1 2010-01-28 r3054 [i486-slackware-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
Opened configuration file /etc/smartd.conf
Configuration file /etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
Device: /dev/sda, opened
Device: /dev/sda, IE (SMART) not enabled, skip device
Try 'smartctl -s on /dev/sda' to turn on SMART features
Unable to register SCSI device /dev/sda at line 1 of file /etc/smartd.conf
Device: /dev/sdb, opened
Device: /dev/sdb, IE (SMART) not enabled, skip device
Try 'smartctl -s on /dev/sdb' to turn on SMART features
Unable to register SCSI device /dev/sdb at line 1 of file /etc/smartd.conf
Device: /dev/sdc, opened
Device: /dev/sdc, IE (SMART) not enabled, skip device
Try 'smartctl -s on /dev/sdc' to turn on SMART features
Unable to register SCSI device /dev/sdc at line 1 of file /etc/smartd.conf
Device: /dev/sdd, opened
Device: /dev/sdd, IE (SMART) not enabled, skip device
Try 'smartctl -s on /dev/sdd' to turn on SMART features
Unable to register SCSI device /dev/sdd at line 1 of file /etc/smartd.conf
Device: /dev/sde, opened
Device: /dev/sde, IE (SMART) not enabled, skip device
Try 'smartctl -s on /dev/sde' to turn on SMART features
Unable to register SCSI device /dev/sde at line 1 of file /etc/smartd.conf
Device: /dev/sdf, opened
Device: /dev/sdf, IE (SMART) not enabled, skip device
Try 'smartctl -s on /dev/sdf' to turn on SMART features
Unable to register SCSI device /dev/sdf at line 1 of file /etc/smartd.conf
Unable to monitor any SMART enabled devices. Try debug (-d) option. Exiting...
and /var/log/messages:
Code:
May 2 21:18:40 lhost2 smartd[7922]: smartd 5.39.1 2010-01-28 r3054 [i486-slackware-linux-gnu] (local build) Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
May 2 21:18:40 lhost2 smartd[7922]: Opened configuration file /etc/smartd.conf
May 2 21:18:40 lhost2 smartd[7922]: Configuration file /etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sda, opened
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sda, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sda' to turn on SMART features
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdb, opened
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdb, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sdb' to turn on SMART features
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdc, opened
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdc, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sdc' to turn on SMART features
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdd, opened
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdd, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sdd' to turn on SMART features
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sde, opened
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sde, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sde' to turn on SMART features
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdf, opened
May 2 21:18:40 lhost2 smartd[7922]: Device: /dev/sdf, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sdf' to turn on SMART features
May 2 21:18:40 lhost2 smartd[7922]: Unable to monitor any SMART enabled devices. Try debug (-d) option. Exiting...
So any "smart" people out there?? I need to mention that I only use SATA drives... I tried with ata in the config file, but no success.
OK I got it to work (kinda).... I used -d ata in my smartd.conf file as the parameter to specify the drive type...
Now smartd runs normally (seems to...) but I wonder how to actually run it in the background?
Right now I am calling smartd from rc.local and by default, smartd output its logs and messages to /var/log/messages. I'd rather have them going in a log lets say in /var/log/smartd.... How to do that?
my command to test my setup in smartd.conf is
Code:
/dev/sda -d ata -a -I 194 -I 231 -I 9 -W 5,45,55 -m email@gmail.com
So I believe this command will...
-Specify that /dev/sda is a ata drive (even if it is a SATA drive...)
-Ignores the bytes 194 & 231 (current temperature) because this will change all the time and I dont want an email every time it changes...
-Ignores the byte 9 (Power on time count)
-Report variations of 5C or more, warn if reached 45C (informational) and re-warn if reached 55C (critical)
-Mail all events above to email@gmail.com
Hey guys, back to this topic here, I just experienced a strange occurence with a HDD... Not sure what happened because the drive is running fine now, but I remember when that happened, I tried to perform a smart test on the drive and it said that it couldnt read the log or something.. Which makes me wonder if the chipset on the drive is not going..
Anyways, if this smart monitoring thing was working, it would be helpful to know if a drive is going bad and require replacement.
Anybody can help? I think im close to getting it to work. For the remaining issues, please look at my last post.
OK all is fine now... except with the following scenario:
6 HDD permanently plugged to mobo SATA ports. These drives dont change. 2 HDD's connected to hotswap bays. These drives are being turned on/off on demand for backup purposes. If one of these drives is turned ON when the system boots, linux will randomly assign /dev/sdX to these 6+ drives screwing up the nomenclature /dev/sda, /dev/sdb... My fstab & md raid are using UUID's instead of /dev/sdX for assembly & mounting.
As of now, smartd is using /dev/sda, /dev/sdb... /dev/sdf for monitoring. Like I previously said, if one of the hotswap drive is on at boot time, linux will give it /dev/sda or /dev/sdb, resulting in smartd monitoring this drive, but not monitoring the last drive who got tranbsfered... Not good. Also, if I turn off one of these hotswap drives, smartd will freak out because it cant contact the drive.
So my question is: how can I make smart monitor by port numbers (for example the mobo's SATA ports) and not the other ports where the jotswap drives are connected to?
Again, seems like Im the only on on the planet to try this... but it seems to basic. Every windows server are capable of this so I imagine smartd can ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.