Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Audible warning when HDD goes bad

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
djevlen
Posts: 16
Joined: 2013-02-06 20:08

Audible warning when HDD goes bad

#1 Post by djevlen »

Hi

How to configure hdd monitoring so when hdd is about to fail or S.M.A.R.T. is logging errors, the motherboard onboard speaker will give audible warnings ?

OS : Debian 10 buster
Mobo : Supermicro X7SPE-HF

All other similar questions are how to send email ...
Im not interested in emails...Server is at home and so am i... Audible warning will draw my attention must faster.

Any help would be greatly appreciated.
Thanx

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Audible warning when HDD goes bad

#2 Post by pylkko »

I don't think that there is a ready-made solution for this, but I may be wrong. However, you could in theory use beep

https://manpages.debian.org/buster/beep/beep.1.en.html

for example, in a script which polls the SMART data. This means that you would need to decide an interval at which to check the data (once a day? Once every hour?) and then check that a value is not exceeded (which ever value you are interested) and then have that script make the sound.

However, you must realize that hard drives many times fail without warning or that the indicator of detrimental change is not a necessarily a number, but how quickly the number changes. SO in this kind of case you would need a more sophisticated decision marker than a simple cutoff (like keep a history of some sort)

Also, this kind of thing might already be programmed into the firmware/UEFI/BIOS, so check that.

djevlen
Posts: 16
Joined: 2013-02-06 20:08

Re: Audible warning when HDD goes bad

#3 Post by djevlen »

hi

i know it should be something like this DEVICESCAN [...other...options...] -m <nomailer> -M exec /path/to/your/script

The problem is that i have no idea how to make scripts....

installed beep, but it only wants to run as root....

Strange no one else asked for this feature before.....

Hope some one will sooner or later see this thread and post a simple how to do...

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Audible warning when HDD goes bad

#4 Post by pylkko »

What are you saying? When you say "i know it should be something like this", in that sentence what is "it"? How do you know this? and why should something be something? Do you have previous experience with a software of this type.

If you do not have this option in your firmware, and you do not want to specify what you want to monitor (why do you not answer at least this, there is no way anyone can come here and reply to you unless you do). Then one thing you could do is run smartctl, which return as 0 if all is ok:

https://linux.die.net/man/8/smartctl

So, then your script would be something like do "beep" if smartctl returns something else than zero.
How often would you like to do this beep? For ever? or a short beep every certain minute/second?

djevlen
Posts: 16
Joined: 2013-02-06 20:08

Re: Audible warning when HDD goes bad

#5 Post by djevlen »

the optimal script would beep when smartctl throws an error. I would use H option in smartctl because that way its not spinning up the disk...full scan of course spins them up..my discs support 0x0003 feature...so the data is saved before they spin down.

something like this:
smartctl -H -d ata /dev/sda
smartctl -H -d ata /dev/sdb
smartctl -H -d ata /dev/sdc

and if error occurs the sound should be something like this : beep -r 99999 -l 150 -f 700 -D 1000

and the perfect version would be if it fails on sda then only 1 beep , if on sdb then 2 short beeps, if on sdc then 3 short beeps

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Audible warning when HDD goes bad

#6 Post by pylkko »

In a bash shell you can get the exit code of a command with $?

so if you do the command smartctl, /dev/sda and you get the exit code bit mask described in the man of smartctl, you can then use this to do the beep

This is described in detail in this guide:
https://www.cyberciti.biz/faq/bash-get- ... f-command/

once the script runs, then make a sytemd service to autolaunch it.

if you need more help, ask.

djevlen
Posts: 16
Joined: 2013-02-06 20:08

Re: Audible warning when HDD goes bad

#7 Post by djevlen »

how can i test it when i have no broken disc and no errors at all ?

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Audible warning when HDD goes bad

#8 Post by pylkko »

You make a pseudobroken disk, I guess. For example, smartcrl will return zero when you don't have permission. Or you make a script that beeps with grave error and just prints something when not.

Post Reply