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
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, 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 :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
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 windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

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
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, 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 :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
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.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, 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 :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

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
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, 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 :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

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