Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Do I really need smartd? - Use cron instead?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1579
Location: KUUSANKOSKI, Finland

PostPosted: Sun Oct 07, 2018 4:39 pm    Post subject: Do I really need smartd? - Use cron instead? Reply with quote

Like the topic subject already stated. But is there some critical difference?

I'd like to run smart checks after btrfs device stats / has been run.
Then after smart checks are (hopefully) ok, then run some btrfs maintenance commands if needed.

I'm planning to write a simple script which runs these checks and redirects all the messages to syslog.

So is there any drawback to run smartctl from cron instead of smartd?
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 697
Location: tra veneto e friuli (italy)

PostPosted: Mon Oct 08, 2018 6:43 pm    Post subject: Reply with quote

For sure there are a way to avoid smartd, but remember that with smartd you can monitor changes in some SMART IDs.
Just to name a few for Seagate drives:
5 Reallocated Sectors Count
187 Reported Uncorrectable Errors
188 Command Timeout
197 Current Pending Sector Count (or with "C" option)
198 Uncorrectable Sector Count (or with "U" option)

So, in your script you have to keep note of previous value of useful SMART ID.
_________________
proud user of faKeDE-4.7.3
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6015

PostPosted: Mon Oct 08, 2018 8:49 pm    Post subject: Reply with quote

smartd handles a lot of tedious setup and work for you by default, but technically it *can* be replaced by just a few cron-driven scripts. The main question is whether that's worth the effort to you.

I just let smartd and the btrfs scrub commands run independently, because they shouldn't (in theory) interfere with each other.
Back to top
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1579
Location: KUUSANKOSKI, Finland

PostPosted: Tue Oct 09, 2018 2:41 pm    Post subject: Reply with quote

Got it. Thanks guys.

I'll save a lot of headaches by using the daemon. I'll go and use it. :)
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 4334
Location: Dallas area

PostPosted: Tue Oct 09, 2018 2:44 pm    Post subject: Reply with quote

You can even have the daemon mail you if it sees certain problems.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.1 (no-pie & modified) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1579
Location: KUUSANKOSKI, Finland

PostPosted: Mon Nov 05, 2018 6:59 pm    Post subject: Reply with quote

I see some problems with smartd scheduling.
My desktop PC isn't on 24/7. So if a time windows for smart test has passed while PC was off then the test is skipped. Right? How can I tell smartd to run the missed tests e.g. at any day after 21:00? Is it possible?
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Tue Nov 06, 2018 2:10 pm    Post subject: Reply with quote

smartd runs the specified tests unconditionally, but that unconditional [day/date/time] specification can include regex expressions.

If you schedule a test for specified day at 21:00, it will run at 21:00 if the computer is on, otherwise it won't run. I generally set up short test for 6 days out of the week, and a long test on one weekend day, setting the time to avoid disk-busy, such as scheduled backup.
Back to top
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1579
Location: KUUSANKOSKI, Finland

PostPosted: Tue Nov 06, 2018 9:47 pm    Post subject: Reply with quote

What a pity. :|

I wonder if I run smartd normally, but without any scheduled tests and then run the tests via cron... will smartd still log smart data..?
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 853

PostPosted: Wed Nov 07, 2018 10:46 am    Post subject: Reply with quote

The test results are logged in the drive, accessible on a query. I have smartd set up to run the tests I mentioned, short tests at 1 am, long tests at 3 am saturday, and crond set up to run $(smartctl -l selftest $i | head | tail -5) [$i is a set of drives, /dev/sda, etc.] as part of cron.daily.

The smartd tests commanded to run don't usually deliver any report to the console. The daemon does deliver reports on error events, such as "too hot" or other hardware failures, and it does THAT promptly, not scheduled.

I'd keep smartd running. It queries the drive on its own initiative and keeps track of operation in an effort to detect risky abnormalities. As for the tests commanded from command line, sure, do that all from cron, but it takes a separate command to see the result, assuming no risky attributes were detected as part of the test.

Edit to add typical smartd.conf config entries and related remarks ....

Code:
/dev/sda -a -I 194 -W 3,33,37 -R 5 -s (L/../../6/03|S/../.././01) -m cboldt@hypoid


The -W is a call to monitor Monitor Temperature D)ifference, I)nformal limit, C)ritical limit. The values "3,33,37" were developed from experience on this particular drive, in this particular machine. Other drives have different values. I know from experience that smartd will send error messages on temperature offenses, and use that experience to set the limits in smartd.conf.

Different machine, and a pair of lines from /etc/smartd.conf

Code:
/dev/sda -d sat -a -I 194 -W 3,42,44 -t -r 193 -R 5! -v 197,increasing -s (L/../../6/03|S/../.././01) -m cboldt@mail.
/dev/disk/by-label/involute-2 -d sat -a -I 194 -W 3,42,45 -t -r 193 -R 5! -n standby -s        S/../.././01 -m cboldt@mail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum