Post by Ray AndrewsPost by Carlos E. R.Post by Ray AndrewsAnd 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 all
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 function
does not exist at all.
Right, I can see that the system only really works one way. But if one
was doing a full 'badblocks' scan anyway then surely the information
would be available at that time? Nuts, even a raw dump of the block
would give you some idea what's there. That's how it used to work under
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.
Post by Ray Andrews"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'."
# Export message with trailing newline
export SMARTD_FULLMESSAGE="$fullmessage
"
export SMARTD_ERROR="${SMARTD_MESSAGE-[SMARTD_MESSAGE]}"
#!/bin/zsh
tmp=$(tempfile)
cat > $tmp
echo -n "$( date ):" >>! /var/lib/smartmontools/smartd-log
SMARTD_PREVIOUS=$( cat /var/lib/smartmontools/smartd-previous )
if [ "$SMARTD_PREVIOUS" = "$SMARTD_ERROR" ]; then
echo "IDENTICAL" >>! /var/lib/smartmontools/smartd-log
return
fi
echo "$SMARTD_ERROR" >>! /var/lib/smartmontools/smartd-log
echo "$SMARTD_PREVIOUS" >! /var/lib/smartmontools/smartd-previous
# runs '/usr/bin/smart-notifier -> /usr/share/smart-notifier
/smart-notifier' via '/etc/smartmontools/run.d/60smart-notifier'
run-parts --report --lsbsysinit --arg=$tmp --arg="$1" \
--arg="$2" --arg="$3" -- /etc/smartmontools/run.d
rm -f $tmp
Thu Jan 19 12:02:27 PST 2017 Device: /dev/sdb [SAT], 77 Currently unreadable (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
... So It seems I get one or two messages per day, sometimes about 20 minutes 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 messages, 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? That is, a message if needed every time smartd runs?
------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/smartmontools-support
--
Cheers / Saludos,
Carlos E. R.
(from 42.2 x86_64 "Malachite" at Telcontar)