Re: how to control how often smartd-runner fires.
"Carlos E. R." <[email protected]> Mon, 23 Jan 2017 05:51:06 +0100
| Newsgroups | gmane.linux.utilities.smartmontools |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============2972519834150102509== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mF0USr3Lpg0fk189EeTvnLMsJh4JX4lab" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mF0USr3Lpg0fk189EeTvnLMsJh4JX4lab Content-Type: multipart/mixed; boundary="EcRJnGNPoH17v4Q7u9RJ8lW8OijjdBIJp"; protected-headers="v1" From: "Carlos E. R." <[email protected]> To: [email protected] Message-ID: <[email protected]> Subject: Re: [smartmontools-support] how to control how often smartd-runner fires. References: <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> <[email protected]> In-Reply-To: <[email protected]> --EcRJnGNPoH17v4Q7u9RJ8lW8OijjdBIJp Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2017-01-23 05:17, Ray Andrews wrote: > On 19/01/17 11:08 AM, Carlos E. R. wrote: >> >>> And you'd also think that there'd be a >>> utility that let you know which files were effected so that you could= do >>> something about it. >> >> If you want the reverse, you have to scan all directory entries and al= l >> tables/lists of record locations, one by one, till you hit the one you= >> search for. This is very disk intensive and slow. Sometimes the functi= on >> does not exist at all. > Right, I can see that the system only really works one way. But if one= =20 > was doing a full 'badblocks' scan anyway then surely the information=20 > would be available at that time? Nuts, even a raw dump of the block=20 > would give you some idea what's there. That's how it used to work unde= r=20 > DOS. The badblocks utility doesn't really need to know what is that particular sector for. It just tests sector by sector. I understand it does not even care what filesystem it is. It tests one sector, then the next, then the next... etc. Maybe it would mind if the sector contains data or not. Yes, a raw dump of a sector might give some idea of what it is. If it is text and you recognize it, bingo! But suppose the bad sector is really bad, that you can not read it... That's the worst case. But even in MsDOS locating the file that owned certain sector took time; maybe less than now because disks were smaller, and the basic read speed was about the same as now. The procedure is as I described: first scan the root directory. One entry for each file contains the address of the first sector of a file, and the FAT table has a linked list of sorts to the next sectors. The FAT table can be stored in memory (in the old times, it was limited to a "segment", 64KB), so finding all the sectors of that file is fast. Compare the list with the sector of interest, then try next file in the root directory. Repeat for all directories (a recursive search using findfirst/findnext functions), till the sector of interest is located. It is simple, only intensive. I have the fuzzy idea that a procedure for finding the file that uses a certain sector was discussed somewhere, perhaps on the smartctl howtos. Not for all filesystems. >=20 > As to what Christian said: >=20 > "The '-M exec' script is only run on error conditions which also result= > in a LOG_CRIT syslog message. For LOG_INFO messages issued by smartd, > see the configured syslog. On Debian/Ubuntu, this is usually > '/var/log/daemon.log'." >=20 > It seems counter intuitive. Why run smartd four times a day (or whateve= r) when there is no way to make the error visible more than (it seems) on= ce or twice per day? I did this experiment: >=20 > In smartd_warning.sh: >=20 > # Export message with trailing newline > export SMARTD_FULLMESSAGE=3D"$fullmessage > " > export SMARTD_ERROR=3D"${SMARTD_MESSAGE-[SMARTD_MESSAGE]}" >=20 > In smartd_runner: >=20 > #!/bin/zsh >=20 > tmp=3D$(tempfile) > cat > $tmp >=20 > # Show the time and date of the test, no newline: > echo -n "$( date ):" >>! /var/lib/smartmontools/smartd-log >=20 > # Retrieve prevous error message: > SMARTD_PREVIOUS=3D$( cat /var/lib/smartmontools/smartd-previous ) > # SMARTD_ERROR set in smartd_warning.sh: > if [ "$SMARTD_PREVIOUS" =3D "$SMARTD_ERROR" ]; then > echo "IDENTICAL" >>! /var/lib/smartmontools/smartd-log > # Nothing has changed so abort the notifier: > return > fi > # Message is not identical so echo it to the log: > echo "$SMARTD_ERROR" >>! /var/lib/smartmontools/smartd-log > # And save it for the next comparison: > echo "$SMARTD_PREVIOUS" >! /var/lib/smartmontools/smartd-previous >=20 > # runs '/usr/bin/smart-notifier -> /usr/share/smart-notifier > /smart-notifier' via '/etc/smartmontools/run.d/60smart-notifier' > run-parts --report --lsbsysinit --arg=3D$tmp --arg=3D"$1" \ > --arg=3D"$2" --arg=3D"$3" -- /etc/smartmontools/run.d >=20 > rm -f $tmp >=20 > And I get this: >=20 > Thu Jan 19 12:02:27 PST 2017 Device: /dev/sdb [SAT], 77 Currently unre= adable (pending) sectors > Thu Jan 19 12:26:55 PST 2017:IDENTICAL > Fri Jan 20 12:05:27 PST 2017:IDENTICAL > Fri Jan 20 12:26:55 PST 2017:IDENTICAL > Sat Jan 21 12:57:38 PST 2017:IDENTICAL > Sun Jan 22 16:57:35 PST 2017:IDENTICAL >=20 > ... So It seems I get one or two messages per day, sometimes about 20 m= inutes between them, and there is no way to control how many or when they= show up? Anyway the code above does at least filter out duplicate messa= ges, but I'd expect to have that functionality available stock. If I didn= 't use smart-notifier, could I receive timely messages some other way? T= hat is, a message if needed every time smartd runs? >=20 >=20 >=20 >=20 >=20 >=20 >=20 > -----------------------------------------------------------------------= ------- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Smartmontools-support mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/smartmontools-support >=20 --=20 Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" at Telcontar) --EcRJnGNPoH17v4Q7u9RJ8lW8OijjdBIJp-- --mF0USr3Lpg0fk189EeTvnLMsJh4JX4lab Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAliFi8IACgkQtTMYHG2NR9UyBwCfULDlRyjrXX/8MHiMjUimB2nM fhQAn2FxVzPiyI8ewL7lz5bBslYqUXiS =lhBD -----END PGP SIGNATURE----- --mF0USr3Lpg0fk189EeTvnLMsJh4JX4lab-- --===============2972519834150102509== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot --===============2972519834150102509== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Smartmontools-support mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/smartmontools-support --===============2972519834150102509==--