]>
Commit | Line | Data |
---|---|---|
832b75ed GG |
1 | .ig |
2 | Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net> | |
3 | ||
4 | $Id: smartd.8.in,v 1.100 2006/04/12 13:55:44 ballen4705 Exp $ | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | You should have received a copy of the GNU General Public License (for | |
12 | example COPYING); if not, write to the Free Software Foundation, Inc., | |
13 | 675 Mass Ave, Cambridge, MA 02139, USA. | |
14 | ||
15 | This code was originally developed as a Senior Thesis by Michael | |
16 | Cornwell at the Concurrent Systems Laboratory (now part of the Storage | |
17 | Systems Research Center), Jack Baskin School of Engineering, | |
18 | University of California, Santa Cruz. http://ssrc.soe.ucsc.edu/ | |
19 | .. | |
20 | .TH SMARTD 8 CURRENT_CVS_DATE CURRENT_CVS_VERSION CURRENT_CVS_DATE | |
21 | .SH NAME | |
22 | \fBsmartd\fP \- SMART Disk Monitoring Daemon | |
23 | ||
24 | .SH SYNOPSIS | |
25 | .B smartd [options] | |
26 | ||
27 | .SH FULL PATH | |
28 | .B /usr/local/sbin/smartd | |
29 | ||
30 | .SH PACKAGE VERSION | |
31 | CURRENT_CVS_VERSION released CURRENT_CVS_DATE at CURRENT_CVS_TIME | |
32 | ||
33 | .SH DESCRIPTION | |
34 | \fBsmartd\fP is a daemon that monitors the Self-Monitoring, Analysis | |
35 | and Reporting Technology (SMART) system built into many ATA-3 and | |
36 | later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to | |
37 | monitor the reliability of the hard drive and predict drive failures, | |
38 | and to carry out different types of drive self-tests. This version of | |
39 | \fBsmartd\fP is compatible with ATA/ATAPI-7 and earlier standards (see | |
40 | \fBREFERENCES\fP below). | |
41 | ||
42 | \fBsmartd\fP will attempt to enable SMART monitoring on ATA devices | |
43 | (equivalent to \fBsmartctl -s on\fP) and polls these and SCSI devices | |
44 | every 30 minutes (configurable), logging SMART errors and changes of | |
45 | SMART Attributes via the SYSLOG interface. The default location for | |
46 | these SYSLOG notifications and warnings is \fB/var/log/messages\fP. | |
47 | To change this default location, please see the \fB\'-l\'\fP | |
48 | command-line option described below. | |
49 | ||
50 | In addition to logging to a file, \fBsmartd\fP can also be configured | |
51 | to send email warnings if problems are detected. Depending upon the | |
52 | type of problem, you may want to run self\-tests on the disk, back up | |
53 | the disk, replace the disk, or use a manufacturer\'s utility to force | |
54 | reallocation of bad or unreadable disk sectors. If disk problems are | |
55 | detected, please see the \fBsmartctl\fP manual page and the | |
56 | \fBsmartmontools\fP web page/FAQ for further guidance. | |
57 | ||
58 | If you send a \fBUSR1\fP signal to \fBsmartd\fP it will immediately | |
59 | check the status of the disks, and then return to polling the disks | |
60 | every 30 minutes. See the \fB\'\-i\'\fP option below for additional | |
61 | details. | |
62 | ||
63 | \fBsmartd\fP can be configured at start-up using the configuration | |
64 | file \fB/usr/local/etc/smartd.conf\fP (Windows: \fB./smartd.conf\fP). | |
65 | If the configuration file is subsequently modified, \fBsmartd\fP | |
66 | can be told to re-read the configuration file by sending it a | |
67 | \fBHUP\fP signal, for example with the command: | |
68 | .fi | |
69 | \fBkillall -HUP smartd\fP. | |
70 | .fi | |
71 | (Windows: See NOTES below.) | |
72 | ||
73 | On startup, if \fBsmartd\fP finds a syntax error in the configuration | |
74 | file, it will print an error message and then exit. However if | |
75 | \fBsmartd\fP is already running, then is told with a \fBHUP\fP signal | |
76 | to re-read the configuration file, and then find a syntax error in | |
77 | this file, it will print an error message and then continue, ignoring | |
78 | the contents of the (faulty) configuration file, as if the \fBHUP\fP | |
79 | signal had never been received. | |
80 | ||
81 | When \fBsmartd\fP is running in debug mode, the \fBINT\fP signal | |
82 | (normally generated from a shell with CONTROL\-C) is treated in the | |
83 | same way as a \fBHUP\fP signal: it makes \fBsmartd\fP reload its | |
84 | configuration file. To exit \fBsmartd\fP use CONTROL-\e | |
85 | (Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break). | |
86 | ||
87 | On startup, in the absence of the configuration file | |
88 | \fB/usr/local/etc/smartd.conf\fP, the \fBsmartd\fP daemon first scans for all | |
89 | devices that support SMART. The scanning is done as follows: | |
90 | .IP \fBLINUX:\fP 9 | |
91 | Examine all entries \fB"/dev/hd[a-t]"\fP for IDE/ATA | |
92 | devices, and \fB"/dev/sd[a-z]"\fP for SCSI devices. | |
93 | .IP \fBFREEBSD:\fP 9 | |
94 | Examine all entries \fB"/dev/ad[0-9]+"\fP for IDE/ATA | |
95 | devices and \fB"/dev/da[0-9]+"\fP for SCSI devices. | |
96 | .IP \fBNETBSD/OPENBSD:\fP 9 | |
97 | Authoritative list of disk devices is obtained from sysctl | |
98 | \'hw.disknames\'. | |
99 | .IP \fBSOLARIS:\fP 9 | |
100 | Examine all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk | |
101 | devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices. | |
102 | .IP \fBDARWIN:\fP 9 | |
103 | The IOService plane is scanned for ATA block storage devices. | |
104 | .IP \fBWINDOWS:\fP 9 | |
105 | Examine all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]") | |
106 | for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP | |
107 | (bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME, | |
108 | and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI | |
109 | devices on all versions of Windows. | |
110 | .IP \fBCYGWIN\fP: 9 | |
111 | See "WINDOWS" above. | |
112 | .IP \fBOS/2,eComStation\fP: 9 | |
113 | Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices. | |
114 | .PP | |
115 | \fBsmartd\fP then monitors | |
116 | for \fIall\fP possible SMART errors (corresponding to the \fB\'\-a\'\fP | |
117 | Directive in the configuration file; see \fBCONFIGURATION FILE\fP | |
118 | below). | |
119 | ||
120 | .SH | |
121 | OPTIONS | |
122 | Long options are not supported on all systems. Use \fB\'smartd | |
123 | \-h\'\fP to see the available options. | |
124 | .TP | |
125 | .B \-c FILE, \-\-configfile=FILE | |
126 | ||
127 | Read \fBsmartd\fP configuration Directives from FILE, instead of from | |
128 | the default location \fB/usr/local/etc/smartd.conf\fP (Windows: \fB./smartd.conf\fP). | |
129 | If FILE does \fBnot\fP exist, then \fBsmartd\fP will print an error | |
130 | message and exit with nonzero status. Thus, \'\-c /usr/local/etc/smartd.conf\' | |
131 | can be used to verify the existence of the default configuration file. | |
132 | ||
133 | By using \'\-\' for FILE, the configuration is read from standard | |
134 | input. This is useful for commands like: | |
135 | .nf | |
136 | .B echo /dev/hdb \-m user@home \-M test | smartd \-c \- \-q onecheck | |
137 | .fi | |
138 | to perform quick and simple checks without a configuration file. | |
139 | ||
140 | .TP | |
141 | .B \-d, \-\-debug | |
142 | Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status | |
143 | information to STDOUT rather than logging it to SYSLOG and does not | |
144 | \fBfork(2)\fP into the background and detach from the controlling | |
145 | terminal. In this mode, \fBsmartd\fP also prints more verbose | |
146 | information about what it is doing than when operating in "daemon" | |
147 | mode. In this mode, the \fBQUIT\fP signal (normally generated from a | |
148 | terminal with CONTROL\-C) makes \fBsmartd\fP reload its configuration | |
149 | file. Please use CONTROL-\e to exit | |
150 | (Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break). | |
151 | ||
152 | Windows only: The "debug" mode can be toggled by the command | |
153 | \fBsmartd sigusr2\fP. A new console for debug output is opened when | |
154 | debug mode is enabled. | |
155 | .TP | |
156 | .B \-D, \-\-showdirectives | |
157 | Prints a list (to STDOUT) of all the possible Directives which may | |
158 | appear in the configuration file /usr/local/etc/smartd.conf, and then exits. | |
159 | These Directives are also described later in this man page. They may | |
160 | appear in the configuration file following the device name. | |
161 | .TP | |
162 | .B \-h, \-\-help, \-\-usage | |
163 | Prints usage message to STDOUT and exits. | |
164 | .TP | |
165 | .B \-i N, \-\-interval=N | |
166 | Sets the interval between disk checks to \fIN\fP seconds, where | |
167 | \fIN\fP is a decimal integer. The minimum allowed value is ten and | |
168 | the maximum is the largest positive integer that can be represented on | |
169 | your system (often 2^31-1). The default is 1800 seconds. | |
170 | ||
171 | Note that the superuser can make \fBsmartd\fP check the status of the | |
172 | disks at any time by sending it the \fBSIGUSR1\fP signal, for example | |
173 | with the command: | |
174 | .nf | |
175 | .B kill -SIGUSR1 <pid> | |
176 | .fi | |
177 | where \fB<pid>\fP is the process id number of \fBsmartd\fP. One may | |
178 | also use: | |
179 | .nf | |
180 | .B killall -USR1 smartd | |
181 | .fi | |
182 | for the same purpose. | |
183 | .fi | |
184 | (Windows: See NOTES below.) | |
185 | ||
186 | .TP | |
187 | .B \-l FACILITY, \-\-logfacility=FACILITY | |
188 | Uses syslog facility FACILITY to log the messages from \fBsmartd\fP. | |
189 | Here FACILITY is one of \fIlocal0\fP, \fIlocal1\fP, ..., \fIlocal7\fP, | |
190 | or \fIdaemon\fP [default]. If this command-line option is not used, | |
191 | then by default messages from \fBsmartd\fP are logged to the facility | |
192 | \fIdaemon\fP. | |
193 | ||
194 | If you would like to have \fBsmartd\fP messages logged somewhere other | |
195 | than the default \fB/var/log/messages\fP location, this can typically | |
196 | be accomplished with (for example) the following steps: | |
197 | .RS 7 | |
198 | .IP \fB[1]\fP 4 | |
199 | Modify the script that starts \fBsmartd\fP to include the \fBsmartd\fP | |
200 | command-line argument \'\-l local3\'. This tells \fBsmartd\fP to log its | |
201 | messages to facility \fBlocal3\fP. | |
202 | .IP \fB[2]\fP 4 | |
203 | Modify the \fBsyslogd\fP configuration file (typically | |
204 | \fB/etc/syslog.conf\fP) by adding a line of the form: | |
205 | .nf | |
206 | \fBlocal3.* /var/log/smartd.log\fP | |
207 | .fi | |
208 | This tells \fBsyslogd\fP to log all the messages from facility \fBlocal3\fP to | |
209 | the designated file: /var/log/smartd.log. | |
210 | .IP \fB[3]\fP 4 | |
211 | Tell \fBsyslogd\fP to re-read its configuration file, typically by | |
212 | sending the \fBsyslogd\fP process a \fBSIGHUP\fP hang-up signal. | |
213 | .IP \fB[4]\fP 4 | |
214 | Start (or restart) the \fBsmartd\fP daemon. | |
215 | .RE | |
216 | .\" The following two lines are a workaround for a man2html bug. Please leave them. | |
217 | .\" They define a non-existent option; useful because man2html can't correctly reset the margins. | |
218 | .TP | |
219 | .B \& | |
220 | For more detailed information, please refer to the man pages for | |
221 | \fBsyslog.conf\fP, \fBsyslogd\fP, and \fBsyslog\fP. You may also want | |
222 | to modify the log rotation configuration files; see the man pages for | |
223 | \fBlogrotate\fP and examine your system\'s /etc/logrotate.conf file. | |
224 | ||
225 | Cygwin: Support for \fBsyslogd\fP as described above is available starting with Cygwin 1.5.15. | |
226 | On older releases or if no local \fBsyslogd\fP is running, the \'\-l\' option has no effect. | |
227 | In this case, all \fBsyslog\fP messages are written to Windows event log | |
228 | or to file \fBC:/CYGWIN_SYSLOG.TXT\fP if the event log is not available. | |
229 | ||
230 | Windows: Some \fBsyslog\fP functionality is implemented | |
231 | internally in \fBsmartd\fP as follows: If no \'\-l\' option | |
232 | (or \'\-l daemon\') is specified, messages are written to Windows | |
233 | event log or to file \fB./smartd.log\fP if event log is not available | |
234 | (Win9x/ME or access denied). By specifying other values of FACILITY, | |
235 | log output is redirected as follows: | |
236 | \'\-l local0\' to file \fB./smartd.log\fP, | |
237 | \'\-l local1\' to standard output (redirect with \'>\' to any file), | |
238 | \'\-l local2\' to standard error, | |
239 | \'\-l local[3-7]\': to file \fB./smartd[1-5].log\fP. | |
240 | ||
241 | When using the event log, the enclosed utility \fBsyslogevt.exe\fP | |
242 | should be registered as an event message file to avoid error | |
243 | messages from the event viewer. Use \'\fBsyslogevt -r smartd\fP\' | |
244 | to register, \'\fBsyslogevt -u smartd\fP\' to unregister and | |
245 | \'\fBsyslogevt\fP\' for more help. | |
246 | ||
247 | .TP | |
248 | .B \-p NAME, \-\-pidfile=NAME | |
249 | Writes pidfile \fINAME\fP containing the \fBsmartd\fP Process ID | |
250 | number (PID). To avoid symlink attacks make sure the directory to | |
251 | which pidfile is written is only writable for root. Without this | |
252 | option, or if the \-\-debug option is given, no PID file is written on | |
253 | startup. If \fBsmartd\fP is killed with a maskable signal then the | |
254 | pidfile is removed. | |
255 | .TP | |
256 | .B \-q WHEN, \-\-quit=WHEN | |
257 | Specifies when, if ever, \fBsmartd\fP should exit. The valid | |
258 | arguments are to this option are: | |
259 | ||
260 | .I nodev | |
261 | \- Exit if there are no devices to monitor, or if any errors are found | |
262 | at startup in the configuration file. This is the default. | |
263 | ||
264 | .I errors | |
265 | \- Exit if there are no devices to monitor, or if any errors are found | |
266 | in the configuration file /usr/local/etc/smartd.conf at startup or whenever it | |
267 | is reloaded. | |
268 | ||
269 | .I nodevstartup | |
270 | \- Exit if there are no devices to monitor at startup. But continue | |
271 | to run if no devices are found whenever the configuration file is | |
272 | reloaded. | |
273 | ||
274 | .I never | |
275 | \- Only exit if a fatal error occurs (no remaining system memory, | |
276 | invalid command line arguments). In this mode, even if there are no | |
277 | devices to monitor, or if the configuration file | |
278 | \fB/usr/local/etc/smartd.conf\fP has errors, \fBsmartd\fP will continue to run, | |
279 | waiting to load a configuration file listing valid devices. | |
280 | ||
281 | .I onecheck | |
282 | \- Start \fBsmartd\fP in debug mode, then register devices, then check | |
283 | device\'s SMART status once, and then exit with zero exit status if all | |
284 | of these steps worked correctly. | |
285 | ||
286 | This last option is intended for \'distribution-writers\' who want to | |
287 | create automated scripts to determine whether or not to automatically | |
288 | start up \fBsmartd\fP after installing smartmontools. After starting | |
289 | \fBsmartd\fP with this command-line option, the distribution\'s install | |
290 | scripts should wait a reasonable length of time (say ten seconds). If | |
291 | \fBsmartd\fP has not exited with zero status by that time, the script | |
292 | should send \fBsmartd\fP a SIGTERM or SIGKILL and assume that | |
293 | \fBsmartd\fP will not operate correctly on the host. Conversely, if | |
294 | \fBsmartd\fP exits with zero status, then it is safe to run | |
295 | \fBsmartd\fP in normal daemon mode. If \fBsmartd\fP is unable to | |
296 | monitor any devices or encounters other problems then it will return | |
297 | with non-zero exit status. | |
298 | ||
299 | .I showtests | |
300 | \- Start \fBsmartd\fP in debug mode, then register devices, then write | |
301 | a list of future scheduled self tests to stdout, and then exit with zero | |
302 | exit status if all of these steps worked correctly. | |
303 | Device's SMART status is not checked. | |
304 | ||
305 | This option is intended to test whether the '-s REGEX' directives in | |
306 | smartd.conf will have the desired effect. The output lists the next test | |
307 | schedules, limited to 5 tests per type and device. This is followed by a | |
308 | summary of all tests of each device within the next 90 days. | |
309 | .TP | |
310 | .B \-r TYPE, \-\-report=TYPE | |
311 | Intended primarily to help | |
312 | .B smartmontools | |
313 | developers understand the behavior of | |
314 | .B smartmontools | |
315 | on non-conforming or poorly-conforming hardware. This option reports | |
316 | details of | |
317 | \fBsmartd\fP | |
318 | transactions with the device. The option can be used multiple times. | |
319 | When used just once, it shows a record of the ioctl() transactions | |
320 | with the device. When used more than once, the detail of these ioctl() | |
321 | transactions are reported in greater detail. The valid arguments to | |
322 | this option are: | |
323 | ||
324 | .I ioctl | |
325 | \- report all ioctl() transactions. | |
326 | ||
327 | .I ataioctl | |
328 | \- report only ioctl() transactions with ATA devices. | |
329 | ||
330 | .I scsiioctl | |
331 | \- report only ioctl() transactions with SCSI devices. | |
332 | ||
333 | Any argument may include a positive integer to specify the level of | |
334 | detail that should be reported. The argument should be followed by a | |
335 | comma then the integer with no spaces. For example, \fIataioctl,2\fP | |
336 | The default level is 1, so \'\-r ataioctl,1\' and \'\-r ataioctl\' are | |
337 | equivalent. | |
338 | ||
339 | .TP | |
340 | .B \-\-service | |
341 | Cygwin and Windows only: Enables \fBsmartd\fP to run as a Windows service. | |
342 | ||
343 | On Cygwin, this option simply prevents fork'ing into background mode to | |
344 | allow running \fBsmartd\fP as service via cygrunsrv, see NOTES below. | |
345 | ||
346 | On Windows, this option enables the buildin service support. | |
347 | The option must be specified in the service command line as the first | |
348 | argument. It should not be used from console. | |
349 | See NOTES below for details. | |
350 | ||
351 | .TP | |
352 | .B \-V, \-\-version, \-\-license, \-\-copyright | |
353 | Prints license, copyright, and CVS version information onto | |
354 | STDOUT and then exits. Please include this information if you are | |
355 | reporting bugs, or have specific questions about the behavior of | |
356 | \fBsmartd\fP. | |
357 | ||
358 | .SH EXAMPLES | |
359 | ||
360 | .B | |
361 | smartd | |
362 | .fi | |
363 | Runs the daemon in forked mode. This is the normal way to run | |
364 | \fBsmartd\fP. | |
365 | Entries are logged to SYSLOG (by default | |
366 | .B /var/log/messages.) | |
367 | ||
368 | .B | |
369 | smartd -d -i 30 | |
370 | .fi | |
371 | Run in foreground (debug) mode, checking the disk status | |
372 | every 30 seconds. | |
373 | ||
374 | .B | |
375 | smartd -q onecheck | |
376 | .fi | |
377 | Registers devices, and checks the status of the devices exactly | |
378 | once. The exit status (the bash | |
379 | .B $? | |
380 | variable) will be zero if all went well, and nonzero if no devices | |
381 | were detected or some other problem was encountered. | |
382 | ||
383 | .fi | |
384 | Note that \fBsmartmontools\fP provides a start-up script in | |
385 | \fB/usr/local/etc/rc.d/init.d/smartd\fP which is responsible for starting and | |
386 | stopping the daemon via the normal init interface. Using this script, | |
387 | you can start \fBsmartd\fP by giving the command: | |
388 | .nf | |
389 | .B /usr/local/etc/rc.d/init.d/smartd start | |
390 | .fi | |
391 | and stop it by using the command: | |
392 | .nf | |
393 | .B /usr/local/etc/rc.d/init.d/smartd stop | |
394 | ||
395 | .fi | |
396 | If you want \fBsmartd\fP to start running whenever your machine is | |
397 | booted, this can be enabled by using the command: | |
398 | .nf | |
399 | .B /sbin/chkconfig --add smartd | |
400 | .fi | |
401 | and disabled using the command: | |
402 | .nf | |
403 | .B /sbin/chkconfig --del smartd | |
404 | .fi | |
405 | ||
406 | .\" DO NOT MODIFY THIS OR THE FOLLOWING TWO LINES. THIS MATERIAL | |
407 | .\" IS AUTOMATICALLY INCLUDED IN THE FILE smartd.conf.5 | |
408 | .\" STARTINCLUDE | |
409 | ||
410 | .SH CONFIGURATION FILE /usr/local/etc/smartd.conf | |
411 | In the absence of a configuration file, under Linux | |
412 | \fBsmartd\fP | |
413 | will try to open the 20 ATA devices | |
414 | .B /dev/hd[a-t] | |
415 | and the 26 SCSI devices | |
416 | .B /dev/sd[a-z]. | |
417 | Under FreeBSD, | |
418 | \fBsmartd\fP | |
419 | will try to open all existing ATA devices (with entries in /dev) | |
420 | .B /dev/ad[0-9]+ | |
421 | and all existing SCSI devices | |
422 | .B /dev/da[0-9]+. | |
423 | Under NetBSD/OpenBSD, | |
424 | \fBsmartd\fP | |
425 | will try to open all existing ATA devices (with entries in /dev) | |
426 | .B /dev/wd[0-9]+c | |
427 | and all existing SCSI devices | |
428 | .B /dev/sd[0-9]+c. | |
429 | Under Solaris \fBsmartd\fP will try to open all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk | |
430 | devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices. | |
431 | Under Windows \fBsmartd\fP will try to open all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]") | |
432 | for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP | |
433 | (bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME, | |
434 | and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI | |
435 | devices on all versions of Windows. | |
436 | Under Darwin, \fBsmartd\fP will open any ATA block storage device. | |
437 | ||
438 | This can be annoying if you have an ATA or SCSI device that hangs or | |
439 | misbehaves when receiving SMART commands. Even if this causes no | |
440 | problems, you may be annoyed by the string of error log messages about | |
441 | block-major devices that can\'t be found, and SCSI devices that can\'t | |
442 | be opened. | |
443 | ||
444 | One can avoid this problem, and gain more control over the types of | |
445 | events monitored by | |
446 | \fBsmartd\fP, | |
447 | by using the configuration file | |
448 | .B /usr/local/etc/smartd.conf. | |
449 | This file contains a list of devices to monitor, with one device per | |
450 | line. An example file is included with the | |
451 | .B smartmontools | |
452 | distribution. You will find this sample configuration file in | |
453 | \fB/usr/local/share/doc/smartmontools-5.1/\fP. For security, the configuration file | |
454 | should not be writable by anyone but root. The syntax of the file is as | |
455 | follows: | |
456 | .IP \(bu 4 | |
457 | There should be one device listed per line, although you may have | |
458 | lines that are entirely comments or white space. | |
459 | .IP \(bu 4 | |
460 | Any text following a hash sign \'#\' and up to the end of the line is | |
461 | taken to be a comment, and ignored. | |
462 | .IP \(bu 4 | |
463 | Lines may be continued by using a backslash \'\e\' as the last | |
464 | non-whitespace or non-comment item on a line. | |
465 | .IP \(bu 4 | |
466 | Note: a line whose first character is a hash sign \'#\' is treated as | |
467 | a white-space blank line, \fBnot\fP as a non-existent line, and will | |
468 | \fBend\fP a continuation line. | |
469 | .PP 0 | |
470 | .fi | |
471 | Here is an example configuration file. It\'s for illustrative purposes | |
472 | only; please don\'t copy it onto your system without reading to the end | |
473 | of the | |
474 | .B DIRECTIVES | |
475 | Section below! | |
476 | ||
477 | .nf | |
478 | .B ################################################ | |
479 | .B # This is an example smartd startup config file | |
480 | .B # /usr/local/etc/smartd.conf for monitoring three | |
481 | .B # ATA disks, three SCSI disks, six ATA disks | |
482 | .B # behind two 3ware controllers and one SATA disk | |
483 | .B # | |
484 | .nf | |
485 | .B # First ATA disk on two different interfaces. On | |
486 | .B # the second disk, start a long self-test every | |
487 | .B # Sunday between 3 and 4 am. | |
488 | .B # | |
489 | .B \ \ /dev/hda -a -m admin@example.com,root@localhost | |
490 | .B \ \ /dev/hdc -a -I 194 -I 5 -i 12 -s L/../../7/03 | |
491 | .B # | |
492 | .nf | |
493 | .B # SCSI disks. Send a TEST warning email to admin on | |
494 | .B # startup. | |
495 | .B # | |
496 | .B \ \ /dev/sda | |
497 | .B \ \ /dev/sdb -m admin@example.com -M test | |
498 | .B # | |
499 | .nf | |
500 | .B # Strange device. It\'s SCSI. Start a scheduled | |
501 | .B # long self test between 5 and 6 am Monday/Thursday | |
502 | .B \ \ /dev/weird -d scsi -s L/../../(1|4)/05 | |
503 | .B # | |
504 | .nf | |
505 | .B # Linux-specific: SATA disk using the libata | |
506 | .B # driver. This requires a 2.6.15 or greater | |
507 | .B # kernel. The device entry is SCSI but the | |
508 | .B # underlying disk understands ATA SMART commands | |
509 | .B \ \ /dev/sda -a -d ata | |
510 | .B # | |
511 | .nf | |
512 | .B # Four ATA disks on a 3ware 6/7/8000 controller. | |
513 | .B # Start short self-tests daily between midnight and 1am, | |
514 | .B # 1-2, 2-3, and 3-4 am. Starting with the Linux 2.6 | |
515 | .B # kernel series, /dev/sdX is deprecated in favor of | |
516 | .B # /dev/tweN. For example replace /dev/sdc by /dev/twe0 | |
517 | .B # and /dev/sdd by /dev/twe1. | |
518 | .B \ \ /dev/sdc -d 3ware,0 -a -s S/../.././00 | |
519 | .B \ \ /dev/sdc -d 3ware,1 -a -s S/../.././01 | |
520 | .B \ \ /dev/sdd -d 3ware,2 -a -s S/../.././02 | |
521 | .B \ \ /dev/sdd -d 3ware,3 -a -s S/../.././03 | |
522 | .B # | |
523 | .nf | |
524 | .B # Two ATA disks on a 3ware 9000 controller. | |
525 | .B # Start long self-tests Sundays between midnight and | |
526 | .B # 1am and 2-3 am | |
527 | .B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00 | |
528 | .B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02 | |
529 | .B # | |
530 | .nf | |
531 | .B # The following line enables monitoring of the | |
532 | .B # ATA Error Log and the Self-Test Error Log. | |
533 | .B # It also tracks changes in both Prefailure | |
534 | .B # and Usage Attributes, apart from Attributes | |
535 | .B # 9, 194, and 231, and shows continued lines: | |
536 | .B # | |
537 | .B \ \ /dev/hdd\ -l\ error\ \e | |
538 | .B \ \ \ \ \ \ \ \ \ \ \ -l\ selftest\ \e | |
539 | .B \ \ \ \ \ \ \ \ \ \ \ -t\ \e\ \ \ \ \ \ # Attributes not tracked: | |
540 | .B \ \ \ \ \ \ \ \ \ \ \ -I\ 194\ \e\ \ # temperature | |
541 | .B \ \ \ \ \ \ \ \ \ \ \ -I\ 231\ \e\ \ # also temperature | |
542 | .B \ \ \ \ \ \ \ \ \ \ \ -I 9\ \ \ \ \ \ # power-on hours | |
543 | .B # | |
544 | .B ################################################ | |
545 | .fi | |
546 | ||
547 | .PP | |
548 | .SH CONFIGURATION FILE DIRECTIVES | |
549 | .PP | |
550 | ||
551 | If the first non-comment entry in the configuration file is the text | |
552 | string | |
553 | .B DEVICESCAN | |
554 | in capital letters, then | |
555 | \fBsmartd\fP | |
556 | will ignore any remaining lines in the configuration file, and will | |
557 | scan for devices. | |
558 | .B DEVICESCAN | |
559 | may optionally be followed by Directives that will apply to all | |
560 | devices that are found in the scan. Please see below for additional | |
561 | details. | |
562 | ||
563 | .sp 2 | |
564 | The following are the Directives that may appear following the device | |
565 | name or | |
566 | .B DEVICESCAN | |
567 | on any line of the | |
568 | .B /usr/local/etc/smartd.conf | |
569 | configuration file. Note that | |
570 | .B these are NOT command-line options for | |
571 | \fBsmartd\fP. | |
572 | The Directives below may appear in any order, following the device | |
573 | name. | |
574 | ||
575 | .B For an ATA device, | |
576 | if no Directives appear, then the device will be monitored | |
577 | as if the \'\-a\' Directive (monitor all SMART properties) had been given. | |
578 | ||
579 | .B If a SCSI disk is listed, | |
580 | it will be monitored at the maximum implemented level: roughly | |
581 | equivalent to using the \'\-H \-l selftest\' options for an ATA disk. | |
582 | So with the exception of \'\-d\', \'\-m\', \'\-l selftest\', \'\-s\', and | |
583 | \'\-M\', the Directives below are ignored for SCSI disks. For SCSI | |
584 | disks, the \'\-m\' Directive sends a warning email if the SMART status | |
585 | indicates a disk failure or problem, if the SCSI inquiry about disk | |
586 | status fails, or if new errors appear in the self-test log. | |
587 | ||
588 | .B If a 3ware controller is used | |
589 | then the corresponding SCSI (/dev/sd?) or character device (/dev/twe? | |
590 | or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive | |
591 | (see below). The individual ATA disks hosted by the 3ware controller | |
592 | appear to \fBsmartd\fP as normal ATA devices. Hence all the ATA | |
593 | directives can be used for these disks (but see note below). | |
594 | ||
595 | .TP | |
596 | .B \-d TYPE | |
597 | Specifies the type of the device. This Directive may be used multiple | |
598 | times for one device, but the arguments \fIata\fP, \fIscsi\fP, | |
599 | \fImarvell\fP, and \fI3ware,N\fP are mutually-exclusive. If more than | |
600 | one is given then \fBsmartd\fP will use the last one which appears. | |
601 | ||
602 | If none of these three arguments is given, then \fBsmartd\fP will | |
603 | first attempt to guess the device type by looking at whether the sixth | |
604 | character in the device name is an \'s\' or an \'h\'. This will work for | |
605 | device names like /dev/hda or /dev/sdb, and corresponds to choosing | |
606 | \fIata\fP or \fIscsi\fP respectively. If | |
607 | \fBsmartd\fP | |
608 | can\'t guess from this sixth character, then it will simply try to | |
609 | access the device using first ATA and then SCSI ioctl()s. | |
610 | ||
611 | The valid arguments to this Directive are: | |
612 | ||
613 | .I ata | |
614 | \- the device type is ATA. This prevents | |
615 | \fBsmartd\fP | |
616 | from issuing SCSI commands to an ATA device. | |
617 | ||
618 | .I scsi | |
619 | \- the device type is SCSI. This prevents | |
620 | \fBsmartd\fP | |
621 | from issuing ATA commands to a SCSI device. | |
622 | ||
623 | .I marvell | |
624 | \- Under Linux, interact with SATA disks behind Marvell chip-set | |
625 | controllers (using the Marvell rather than libata driver). | |
626 | ||
627 | .I 3ware,N | |
628 | \- the device consists of one or more ATA disks connected to a 3ware | |
629 | RAID controller. The non-negative integer N (in the range from 0 to 15 | |
630 | inclusive) denotes which disk on the controller is monitored. In log | |
631 | files and email messages this disk will be identified as 3ware_disk_XX | |
632 | with XX in the range from 00 to 15 inclusive. | |
633 | ||
634 | This Directive may at first appear confusing, because the 3ware | |
635 | controller is a SCSI device (such as /dev/sda) and should be listed as | |
636 | such in the the configuration file. | |
637 | However when the \'\-d 3ware,N\' | |
638 | Directive is used, then the corresponding disk is addressed using | |
639 | native ATA commands which are \'passed through\' the SCSI driver. All | |
640 | ATA Directives listed in this man page may be used. Note that while | |
641 | you may use \fBany\fP of the 3ware SCSI logical devices /dev/sd? to | |
642 | address \fBany\fP of the physical disks (3ware ports), error and log | |
643 | messages will make the most sense if you always list the 3ware SCSI | |
644 | logical device corresponding to the particular physical disks. Please | |
645 | see the \fBsmartctl\fP man page for further details. | |
646 | ||
647 | ATA disks behind 3ware controllers may alternatively be accessed via a | |
648 | character device interface /dev/twe0-15 (3ware 6000/7000/8000 | |
649 | controllers) and /dev/twa0-15 (3ware 9000 series controllers). Note | |
650 | that the 9000 series controllers may \fBonly\fP be accessed using the | |
651 | character device interface /dev/twa0-15 and not the SCSI device | |
652 | interface /dev/sd?. Please see the \fBsmartctl\fP man page for | |
653 | further details. | |
654 | ||
655 | Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\' | |
656 | (\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands | |
657 | to the disk, if the SCSI interface is used, and produce these types of | |
658 | harmless syslog error messages instead: \fB\'3w-xxxx: tw_ioctl(): | |
659 | Passthru size (123392) too big\'\fP. This can be fixed by upgrading to | |
660 | version 1.02.00.037 or later of the 3w-xxxx driver, or by applying a | |
661 | patch to older versions. See | |
662 | \fBhttp://smartmontools.sourceforge.net/\fP for instructions. | |
663 | Alternatively use the character device interfaces /dev/twe0-15 (3ware | |
664 | 6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series | |
665 | controllers). | |
666 | ||
667 | ||
668 | .B 3ware controllers are currently ONLY supported under Linux. | |
669 | ||
670 | .I removable | |
671 | \- the device or its media is removable. This indicates to | |
672 | \fBsmartd\fP | |
673 | that it should continue (instead of exiting, which is the default | |
674 | behavior) if the device does not appear to be present when | |
675 | \fBsmartd\fP is started. This Directive may be used in conjunction | |
676 | with the other \'\-d\' Directives. | |
677 | ||
678 | .TP | |
679 | .B \-n POWERMODE[,q] | |
680 | This \'nocheck\' Directive is used to prevent a disk from being | |
681 | spun-up when it is periodically polled by \fBsmartd\fP. | |
682 | ||
683 | ATA disks have five different power states. In order of increasing | |
684 | power consumption they are: \'OFF\', \'SLEEP\', \'STANDBY\', \'IDLE\', | |
685 | and \'ACTIVE\'. Typically in the OFF, SLEEP, and STANDBY modes the | |
686 | disk\'s platters are not spinning. But usually, in response to SMART | |
687 | commands issued by \fBsmartd\fP, the disk platters are spun up. So if | |
688 | this option is not used, then a disk which is in a low\-power mode may | |
689 | be spun up and put into a higher\-power mode when it is periodically | |
690 | polled by \fBsmartd\fP. | |
691 | ||
692 | Note that if the disk is in SLEEP mode when \fBsmartd\fP is started, | |
693 | then it won't respond to \fBsmartd\fP commands, and so the disk won't | |
694 | be registered as a device for \fBsmartd\fP to monitor. If a disk is in | |
695 | any other low\-power mode, then the commands issued by \fBsmartd\fP to | |
696 | register the disk will probably cause it to spin\-up. | |
697 | ||
698 | The \'\fB\-n\fP\' (nocheck) Directive specifies if \fBsmartd\fP\'s | |
699 | periodic checks should still be carried out when the device is in a | |
700 | low\-power mode. It may be used to prevent a disk from being spun\-up | |
701 | by periodic \fBsmartd\fP polling. The allowed values of POWERMODE | |
702 | are: | |
703 | ||
704 | .I never | |
705 | \- \fBsmartd\fP will poll (check) the device regardless of its power | |
706 | mode. This may cause a disk which is spun\-down to be spun\-up when | |
707 | \fBsmartd\fP checks it. This is the default behavior if the '\-n' | |
708 | Directive is not given. | |
709 | ||
710 | .I sleep | |
711 | \- check the device unless it is in SLEEP mode. | |
712 | ||
713 | .I standby | |
714 | \- check the device unless it is in SLEEP or STANDBY mode. In | |
715 | these modes most disks are not spinning, so if you want to prevent | |
716 | a laptop disk from spinning up each time that \fBsmartd\fP polls, | |
717 | this is probably what you want. | |
718 | ||
719 | .I idle | |
720 | \- check the device unless it is in SLEEP, STANDBY or IDLE mode. | |
721 | In the IDLE state, most disks are still spinning, so this is probably | |
722 | not what you want. | |
723 | ||
724 | When a periodic test is skipped, \fBsmartd\fP normally writes an | |
725 | informal log message. The message can be suppressed by appending | |
726 | the option \',q\' to POWERMODE (like \'\-n standby,q\'). | |
727 | This prevents a laptop disk from spinning up due to this message. | |
728 | ||
729 | .TP | |
730 | .B \-T TYPE | |
731 | Specifies how tolerant | |
732 | \fBsmartd\fP | |
733 | should be of SMART command failures. The valid arguments to this | |
734 | Directive are: | |
735 | ||
736 | .I normal | |
737 | \- do not try to monitor the disk if a mandatory SMART command fails, but | |
738 | continue if an optional SMART command fails. This is the default. | |
739 | ||
740 | .I permissive | |
741 | \- try to monitor the disk even if it appears to lack SMART | |
742 | capabilities. This may be required for some old disks (prior to | |
743 | ATA\-3 revision 4) that implemented SMART before the SMART standards | |
744 | were incorporated into the ATA/ATAPI Specifications. This may also be | |
745 | needed for some Maxtor disks which fail to comply with the ATA | |
746 | Specifications and don't properly indicate support for error\- or | |
747 | self\-test logging. | |
748 | ||
749 | [Please see the \fBsmartctl \-T\fP command-line option.] | |
750 | .TP | |
751 | .B \-o VALUE | |
752 | Enables or disables SMART Automatic Offline Testing when | |
753 | \fBsmartd\fP | |
754 | starts up and has no further effect. The valid arguments to this | |
755 | Directive are \fIon\fP and \fIoff\fP. | |
756 | ||
757 | The delay between tests is vendor-specific, but is typically four | |
758 | hours. | |
759 | ||
760 | Note that SMART Automatic Offline Testing is \fBnot\fP part of the ATA | |
761 | Specification. Please see the | |
762 | .B smartctl \-o | |
763 | command-line option documentation for further information about this | |
764 | feature. | |
765 | .TP | |
766 | .B \-S VALUE | |
767 | Enables or disables Attribute Autosave when \fBsmartd\fP | |
768 | starts up and has no further effect. The valid arguments to this | |
769 | Directive are \fIon\fP and \fIoff\fP. Also affects SCSI devices. | |
770 | [Please see the \fBsmartctl \-S\fP command-line option.] | |
771 | .TP | |
772 | .B \-H | |
773 | Check the SMART health status of the disk. If any Prefailure | |
774 | Attributes are less than or equal to their threshold values, then disk | |
775 | failure is predicted in less than 24 hours, and a message at loglevel | |
776 | .B \'LOG_CRITICAL\' | |
777 | will be logged to syslog. [Please see the | |
778 | .B smartctl \-H | |
779 | command-line option.] | |
780 | .TP | |
781 | .B \-l TYPE | |
782 | Reports increases in the number of errors in one of the two SMART logs. The | |
783 | valid arguments to this Directive are: | |
784 | ||
785 | .I error | |
786 | \- report if the number of ATA errors reported in the ATA Error Log | |
787 | has increased since the last check. | |
788 | ||
789 | .I selftest | |
790 | \- report if the number of failed tests reported in the SMART | |
791 | Self-Test Log has increased since the last check, or if the timestamp | |
792 | associated with the most recent failed test has increased. Note that | |
793 | such errors will \fBonly\fP be logged if you run self-tests on the | |
794 | disk (and it fails a test!). Self-Tests can be run automatically by | |
795 | \fBsmartd\fP: please see the \fB\'\-s\'\fP Directive below. | |
796 | Self-Tests can also be run manually by using the \fB\'\-t\ short\'\fP | |
797 | and \fB\'\-t\ long\'\fP options of \fBsmartctl\fP and the results of | |
798 | the testing can be observed using the \fBsmartctl \'\-l\ selftest\'\fP | |
799 | command-line option.] | |
800 | ||
801 | [Please see the \fBsmartctl \-l\fP and \fB\-t\fP command-line | |
802 | options.] | |
803 | .TP | |
804 | .B \-s REGEXP | |
805 | Run Self-Tests or Offline Immediate Tests, at scheduled times. A | |
806 | Self- or Offline Immediate Test will be run at the end of periodic | |
807 | device polling, if all 12 characters of the string \fBT/MM/DD/d/HH\fP | |
808 | match the extended regular expression \fBREGEXP\fP. Here: | |
809 | .RS 7 | |
810 | .IP \fBT\fP 4 | |
811 | is the type of the test. The values that \fBsmartd\fP will try to | |
812 | match (in turn) are: \'L\' for a \fBL\fPong Self-Test, \'S\' for a | |
813 | \fBS\fPhort Self-Test, \'C\' for a \fBC\fPonveyance Self-Test (ATA | |
814 | only), and \'O\' for an \fBO\fPffline Immediate Test (ATA only). As | |
815 | soon as a match is found, the test will be started and no additional | |
816 | matches will be sought for that device and that polling cycle. | |
817 | .IP \fBMM\fP 4 | |
818 | is the month of the year, expressed with two decimal digits. The | |
819 | range is from 01 (January) to 12 (December) inclusive. Do \fBnot\fP | |
820 | use a single decimal digit or the match will always fail! | |
821 | .IP \fBDD\fP 4 | |
822 | is the day of the month, expressed with two decimal digits. The | |
823 | range is from 01 to 31 inclusive. Do \fBnot\fP | |
824 | use a single decimal digit or the match will always fail! | |
825 | .IP \fBd\fP 4 | |
826 | is the day of the week, expressed with one decimal digit. The | |
827 | range is from 1 (Monday) to 7 (Sunday) inclusive. | |
828 | .IP \fBHH\fP 4 | |
829 | is the hour of the day, written with two decimal digits, and given in | |
830 | hours after midnight. The range is 00 (midnight to just before 1am) | |
831 | to 23 (11pm to just before midnight) inclusive. Do \fBnot\fP use a | |
832 | single decimal digit or the match will always fail! | |
833 | .RE | |
834 | .\" The following two lines are a workaround for a man2html bug. Please leave them. | |
835 | .\" They define a non-existent option; useful because man2html can't correctly reset the margins. | |
836 | .TP | |
837 | .B \& | |
838 | Some examples follow. In reading these, keep in mind that in extended | |
839 | regular expressions a dot \fB\'.\'\fP matches any single character, and | |
840 | a parenthetical expression such as \fB\'(A|B|C)\'\fP denotes any one of the three possibilities \fBA\fP, | |
841 | \fBB\fP, or \fBC\fP. | |
842 | ||
843 | To schedule a short Self-Test between 2-3am every morning, use: | |
844 | .nf | |
845 | \fB \-s S/../.././02\fP | |
846 | .fi | |
847 | To schedule a long Self-Test between 4-5am every Sunday morning, use: | |
848 | .nf | |
849 | \fB \-s L/../../7/04\fP | |
850 | .fi | |
851 | To schedule a long Self-Test between 10-11pm on the first and | |
852 | fifteenth day of each month, use: | |
853 | .nf | |
854 | \fB \-s L/../(01|15)/./22\fP | |
855 | .fi | |
856 | To schedule an Offline Immediate test after every midnight, 6am, | |
857 | noon,and 6pm, plus a Short Self-Test daily at 1-2am and a Long | |
858 | Self-Test every Saturday at 3-4am, use: | |
859 | .nf | |
860 | \fB \-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03)\fP | |
861 | .fi | |
862 | ||
863 | Scheduled tests are run immediately following the regularly-scheduled | |
864 | device polling, if the current local date, time, and test type, match | |
865 | \fBREGEXP\fP. By default the regularly-scheduled device polling | |
866 | occurs every thirty minutes after starting \fBsmartd\fP. Take caution | |
867 | if you use the \'\-i\' option to make this polling interval more than | |
868 | sixty minutes: the poll times may fail to coincide with any of the | |
869 | testing times that you have specified with \fBREGEXP\fP, and so the | |
870 | self tests may not take place as you wish. | |
871 | ||
872 | Before running an offline or self-test, \fBsmartd\fP checks to be sure | |
873 | that a self-test is not already running. If a self-test \fBis\fP | |
874 | already running, then this running self test will \fBnot\fP be | |
875 | interrupted to begin another test. | |
876 | ||
877 | \fBsmartd\fP will not attempt to run \fBany\fP type of test if another | |
878 | test was already started or run in the same hour. | |
879 | ||
880 | Each time a test is run, \fBsmartd\fP will log an entry to SYSLOG. | |
881 | You can use these or the '-q showtests' command-line option to verify | |
882 | that you constructed \fBREGEXP\fP correctly. The matching order | |
883 | (\fBL\fP before \fBS\fP before \fBC\fP before \fBO\fP) ensures that | |
884 | if multiple test types are all scheduled for the same hour, the | |
885 | longer test type has precedence. This is usually the desired behavior. | |
886 | ||
887 | Unix users: please beware that the rules for extended regular | |
888 | expressions [regex(7)] are \fBnot\fP the same as the rules for | |
889 | file\-name pattern matching by the shell [glob(7)]. \fBsmartd\fP will | |
890 | issue harmless informational warning messages if it detects characters | |
891 | in \fBREGEXP\fP that appear to indicate that you have made this | |
892 | mistake. | |
893 | ||
894 | .TP | |
895 | .B \-m ADD | |
896 | Send a warning email to the email address \fBADD\fP if the \'\-H\', | |
897 | \'\-l\', \'\-f\', \'\-C\', or \'\-O\' Directives detect a failure or a | |
898 | new error, or if a SMART command to the disk fails. This Directive | |
899 | only works in conjunction with these other Directives (or with the | |
900 | equivalent default \'\-a\' Directive). | |
901 | ||
902 | To prevent your email in-box from getting filled up with warning | |
903 | messages, by default only a single warning will be sent for each of | |
904 | the enabled alert types, \'\-H\', \'\-l\', \'\-f\', \'\-C\', or | |
905 | \'\-O\' even if more than one failure or error is detected or if the | |
906 | failure or error persists. [This behavior can be modified; see the | |
907 | \'\-M\' Directive below.] | |
908 | ||
909 | To send email to more than one user, please use the following "comma | |
910 | separated" form for the address: \fBuser1@add1,user2@add2,...,userN@addN\fP | |
911 | (with no spaces). | |
912 | ||
913 | To test that email is being sent correctly, use the \'\-M test\' | |
914 | Directive described below to send one test email message on | |
915 | \fBsmartd\fP | |
916 | startup. | |
917 | ||
918 | By default, email is sent using the system | |
919 | .B mail | |
920 | command. In order that | |
921 | \fBsmartd\fP | |
922 | find the mail command (normally /bin/mail) an executable named | |
923 | .B \'mail\' | |
924 | must be in the path of the shell or environment from which | |
925 | \fBsmartd\fP | |
926 | was started. If you wish to specify an explicit path to the mail | |
927 | executable (for example /usr/local/bin/mail) or a custom script to | |
928 | run, please use the \'\-M exec\' Directive below. | |
929 | ||
930 | Note that by default under Solaris, in the previous paragraph, | |
931 | \'\fBmailx\fP\' and \'\fB/bin/mailx\fP\' are used, since Solaris | |
932 | \'/bin/mail\' does not accept a \'\-s\' (Subject) command-line | |
933 | argument. | |
934 | ||
935 | On Windows, the \'\fBBlat\fP\' mailer | |
936 | (\fBhttp://blat.sourceforge.net/\fP) is used by default. | |
937 | This mailer uses a different command line syntax, see | |
938 | \'\-M exec\' below. | |
939 | ||
940 | Note also that there is a special argument | |
941 | .B <nomailer> | |
942 | which can be given to the \'\-m\' Directive in conjunction with the \'\-M | |
943 | exec\' Directive. Please see below for an explanation of its effect. | |
944 | ||
945 | If the mailer or the shell running it produces any STDERR/STDOUT | |
946 | output, then a snippet of that output will be copied to SYSLOG. The | |
947 | remainder of the output is discarded. If problems are encountered in | |
948 | sending mail, this should help you to understand and fix them. If | |
949 | you have mail problems, we recommend running \fBsmartd\fP in debug | |
950 | mode with the \'-d\' flag, using the \'-M test\' Directive described | |
951 | below. | |
952 | ||
953 | The following extension is available on Windows: | |
954 | By specifying \'\fBmsgbox\fP\' as a mail address, a warning | |
955 | "email" is displayed as a message box on the screen. | |
956 | Using both \'\fBmsgbox\fP\' and regular mail addresses is possible, | |
957 | if \'\fBmsgbox\fP\' is the first word in the comma separated list. | |
958 | With \'\fBsysmsgbox\fP\', a system modal (always on top) message box | |
959 | is used. If running as a service, a service notification message box | |
960 | (always shown on current visible desktop) is used. | |
961 | ||
962 | .TP | |
963 | .B \-M TYPE | |
964 | These Directives modify the behavior of the | |
965 | \fBsmartd\fP | |
966 | email warnings enabled with the \'\-m\' email Directive described above. | |
967 | These \'\-M\' Directives only work in conjunction with the \'\-m\' | |
968 | Directive and can not be used without it. | |
969 | ||
970 | Multiple \-M Directives may be given. If more than one of the | |
971 | following three \-M Directives are given (example: \-M once \-M daily) | |
972 | then the final one (in the example, \-M daily) is used. | |
973 | ||
974 | The valid arguments to the \-M Directive are (one of the following | |
975 | three): | |
976 | ||
977 | .I once | |
978 | \- send only one warning email for each type of disk problem detected. This | |
979 | is the default. | |
980 | ||
981 | .I daily | |
982 | \- send additional warning reminder emails, once per day, for each type | |
983 | of disk problem detected. | |
984 | ||
985 | .I diminishing | |
986 | \- send additional warning reminder emails, after a one-day interval, | |
987 | then a two-day interval, then a four-day interval, and so on for each | |
988 | type of disk problem detected. Each interval is twice as long as the | |
989 | previous interval. | |
990 | ||
991 | In addition, one may add zero or more of the following Directives: | |
992 | ||
993 | .I test | |
994 | \- send a single test email | |
995 | immediately upon | |
996 | \fBsmartd\fP | |
997 | startup. This allows one to verify that email is delivered correctly. | |
998 | ||
999 | .I exec PATH | |
1000 | \- run the executable PATH instead of the default mail command, when | |
1001 | \fBsmartd\fP | |
1002 | needs to send email. PATH must point to an executable binary file or | |
1003 | script. | |
1004 | ||
1005 | By setting PATH to point to a customized script, you can make | |
1006 | \fBsmartd\fP perform useful tricks when a disk problem is detected | |
1007 | (beeping the console, shutting down the machine, broadcasting warnings | |
1008 | to all logged-in users, etc.) But please be careful. \fBsmartd\fP | |
1009 | will \fBblock\fP until the executable PATH returns, so if your | |
1010 | executable hangs, then \fBsmartd\fP will also hang. Some sample | |
1011 | scripts are included in | |
1012 | /usr/local/share/doc/smartmontools-5.1/examplescripts/. | |
1013 | ||
1014 | The return status of the executable is recorded by \fBsmartd\fP in | |
1015 | SYSLOG. The executable is not expected to write to STDOUT or | |
1016 | STDERR. If it does, then this is interpreted as indicating that | |
1017 | something is going wrong with your executable, and a fragment of this | |
1018 | output is logged to SYSLOG to help you to understand the problem. | |
1019 | Normally, if you wish to leave some record behind, the executable | |
1020 | should send mail or write to a file or device. | |
1021 | ||
1022 | Before running the executable, \fBsmartd\fP sets a number of | |
1023 | environment variables. These environment variables may be used to | |
1024 | control the executable\'s behavior. The environment variables | |
1025 | exported by \fBsmartd\fP are: | |
1026 | .RS 7 | |
1027 | .IP \fBSMARTD_MAILER\fP 4 | |
1028 | is set to the argument of \-M exec, if present or else to \'mail\' | |
1029 | (examples: /bin/mail, mail). | |
1030 | .IP \fBSMARTD_DEVICE\fP 4 | |
1031 | is set to the device path (examples: /dev/hda, /dev/sdb). | |
1032 | .IP \fBSMARTD_DEVICETYPE\fP 4 | |
1033 | is set to the device type (possible values: ata, scsi, 3ware,N). Here | |
1034 | N=0,...,15 denotes the ATA disk behind a 3ware RAID controller. | |
1035 | .IP \fBSMARTD_DEVICESTRING\fP 4 | |
1036 | is set to the device description. For SMARTD_DEVICETYPE of ata or | |
1037 | scsi, this is the same as SMARTD_DEVICE. For 3ware RAID controllers, | |
1038 | the form used is \'/dev/sdc [3ware_disk_01]\'. In this case the device | |
1039 | string contains a space and is NOT quoted. So to use | |
1040 | $SMARTD_DEVICESTRING in a bash script you should probably enclose it | |
1041 | in double quotes. | |
1042 | .IP \fBSMARTD_FAILTYPE\fP 4 | |
1043 | gives the reason for the warning or message email. The possible values that | |
1044 | it takes and their meanings are: | |
1045 | .nf | |
1046 | .fi | |
1047 | \fIEmailTest\fP: this is an email test message. | |
1048 | .nf | |
1049 | .fi | |
1050 | \fIHealth\fP: the SMART health status indicates imminent failure. | |
1051 | .nf | |
1052 | .fi | |
1053 | \fIUsage\fP: a usage Attribute has failed. | |
1054 | .nf | |
1055 | .fi | |
1056 | \fISelfTest\fP: the number of self-test failures has increased. | |
1057 | .nf | |
1058 | .fi | |
1059 | \fIErrorCount\fP: the number of errors in the ATA error log has increased. | |
1060 | .nf | |
1061 | .fi | |
1062 | \fICurrentPendingSector\fP: one of more disk sectors could not be | |
1063 | read and are marked to be reallocated (replaced with spare sectors). | |
1064 | .nf | |
1065 | .fi | |
1066 | \fIOfflineUncorrectableSector\fP: during off\-line testing, or self\-testing, | |
1067 | one or more disk sectors could not be read. | |
1068 | .nf | |
1069 | .fi | |
1070 | \fIFailedHealthCheck\fP: the SMART health status command failed. | |
1071 | .nf | |
1072 | .fi | |
1073 | \fIFailedReadSmartData\fP: the command to read SMART Attribute data failed. | |
1074 | .nf | |
1075 | .fi | |
1076 | \fIFailedReadSmartErrorLog\fP: the command to read the SMART error log failed. | |
1077 | .nf | |
1078 | .fi | |
1079 | \fIFailedReadSmartSelfTestLog\fP: the command to read the SMART self-test log failed. | |
1080 | .nf | |
1081 | .fi | |
1082 | \fIFailedOpenDevice\fP: the open() command to the device failed. | |
1083 | .IP \fBSMARTD_ADDRESS\fP 4 | |
1084 | is determined by the address argument ADD of the \'\-m\' Directive. | |
1085 | If ADD is \fB<nomailer>\fP, then \fBSMARTD_ADDRESS\fP is not set. | |
1086 | Otherwise, it is set to the comma-separated-list of email addresses | |
1087 | given by the argument ADD, with the commas replaced by spaces | |
1088 | (example:admin@example.com root). If more than one email address is | |
1089 | given, then this string will contain space characters and is NOT | |
1090 | quoted, so to use it in a bash script you may want to enclose it in | |
1091 | double quotes. | |
1092 | .IP \fBSMARTD_MESSAGE\fP 4 | |
1093 | is set to the one sentence summary warning email message string from | |
1094 | \fBsmartd\fP. | |
1095 | This message string contains space characters and is NOT quoted. So to | |
1096 | use $SMARTD_MESSAGE in a bash script you should probably enclose it in | |
1097 | double quotes. | |
1098 | .IP \fBSMARTD_FULLMESSAGE\fP 4 | |
1099 | is set to the contents of the entire email warning message string from | |
1100 | \fBsmartd\fP. | |
1101 | This message string contains space and return characters and is NOT quoted. So to | |
1102 | use $SMARTD_FULLMESSAGE in a bash script you should probably enclose it in | |
1103 | double quotes. | |
1104 | .IP \fBSMARTD_TFIRST\fP 4 | |
1105 | is a text string giving the time and date at which the first problem | |
1106 | of this type was reported. This text string contains space characters | |
1107 | and no newlines, and is NOT quoted. For example: | |
1108 | .nf | |
1109 | .fi | |
1110 | Sun Feb 9 14:58:19 2003 CST | |
1111 | .IP \fBSMARTD_TFIRSTEPOCH\fP 4 | |
1112 | is an integer, which is the unix epoch (number of seconds since Jan 1, | |
1113 | 1970) for \fBSMARTD_TFIRST\fP. | |
1114 | .RE | |
1115 | .\" The following two lines are a workaround for a man2html bug. Please leave them. | |
1116 | .\" They define a non-existent option; useful because man2html can't correctly reset the margins. | |
1117 | .TP | |
1118 | .B \& | |
1119 | The shell which is used to run PATH is system-dependent. For vanilla | |
1120 | Linux/glibc it\'s bash. For other systems, the man page for | |
1121 | \fBpopen\fP(3) should say what shell is used. | |
1122 | ||
1123 | If the \'\-m ADD\' Directive is given with a normal address argument, | |
1124 | then the executable pointed to by PATH will be run in a shell with | |
1125 | STDIN receiving the body of the email message, and with the same | |
1126 | command-line arguments: | |
1127 | .nf | |
1128 | -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS | |
1129 | .fi | |
1130 | that would normally be provided to \'mail\'. Examples include: | |
1131 | .nf | |
1132 | .B -m user@home -M exec /bin/mail | |
1133 | .B -m admin@work -M exec /usr/local/bin/mailto | |
1134 | .B -m root -M exec /Example_1/bash/script/below | |
1135 | .fi | |
1136 | ||
1137 | Note that on Windows, the syntax of the \'\fBBlat\fP\' mailer is | |
1138 | used: | |
1139 | .nf | |
1140 | - -q -subject "$SMARTD_SUBJECT" -to "$SMARTD_ADDRESS" | |
1141 | .fi | |
1142 | ||
1143 | If the \'\-m ADD\' Directive is given with the special address argument | |
1144 | .B <nomailer> | |
1145 | then the executable pointed to by PATH is run in a shell with | |
1146 | .B no | |
1147 | STDIN and | |
1148 | .B no | |
1149 | command-line arguments, for example: | |
1150 | .nf | |
1151 | .B -m <nomailer> -M exec /Example_2/bash/script/below | |
1152 | .fi | |
1153 | If the executable produces any STDERR/STDOUT output, then \fBsmartd\fP | |
1154 | assumes that something is going wrong, and a snippet of that output | |
1155 | will be copied to SYSLOG. The remainder of the output is then | |
1156 | discarded. | |
1157 | ||
1158 | Some EXAMPLES of scripts that can be used with the \'\-M exec\' | |
1159 | Directive are given below. Some sample scripts are also included in | |
1160 | /usr/local/share/doc/smartmontools-5.1/examplescripts/. | |
1161 | ||
1162 | .TP | |
1163 | .B \-f | |
1164 | Check for \'failure\' of any Usage Attributes. If these Attributes are | |
1165 | less than or equal to the threshold, it does NOT indicate imminent | |
1166 | disk failure. It "indicates an advisory condition where the usage or | |
1167 | age of the device has exceeded its intended design life period." | |
1168 | [Please see the \fBsmartctl \-A\fP command-line option.] | |
1169 | .TP | |
1170 | .B \-p | |
1171 | Report anytime that a Prefail Attribute has changed | |
1172 | its value since the last check, 30 minutes ago. [Please see the | |
1173 | .B smartctl \-A | |
1174 | command-line option.] | |
1175 | .TP | |
1176 | .B \-u | |
1177 | Report anytime that a Usage Attribute has changed its value | |
1178 | since the last check, 30 minutes ago. [Please see the | |
1179 | .B smartctl \-A | |
1180 | command-line option.] | |
1181 | .TP | |
1182 | .B \-t | |
1183 | Equivalent to turning on the two previous flags \'\-p\' and \'\-u\'. | |
1184 | Tracks changes in \fIall\fP device Attributes (both Prefailure and | |
1185 | Usage). [Please see the \fBsmartctl\fP \-A command-line option.] | |
1186 | .TP | |
1187 | .B \-i ID | |
1188 | Ignore device Attribute number \fBID\fP when checking for failure of | |
1189 | Usage Attributes. \fBID\fP must be a decimal integer in the range | |
1190 | from 1 to 255. This Directive modifies the behavior of the \'\-f\' | |
1191 | Directive and has no effect without it. | |
1192 | ||
1193 | This is useful, for example, if you have a very old disk and don\'t | |
1194 | want to keep getting messages about the hours-on-lifetime Attribute | |
1195 | (usually Attribute 9) failing. This Directive may appear multiple | |
1196 | times for a single device, if you want to ignore multiple Attributes. | |
1197 | .TP | |
1198 | .B \-I ID | |
1199 | Ignore device Attribute \fBID\fP when tracking changes in the | |
1200 | Attribute values. \fBID\fP must be a decimal integer in the range | |
1201 | from 1 to 255. This Directive modifies the behavior of the \'\-p\', | |
1202 | \'\-u\', and \'\-t\' tracking Directives and has no effect without one | |
1203 | of them. | |
1204 | ||
1205 | This is useful, for example, if one of the device Attributes is the disk | |
1206 | temperature (usually Attribute 194 or 231). It\'s annoying to get reports | |
1207 | each time the temperature changes. This Directive may appear multiple | |
1208 | times for a single device, if you want to ignore multiple Attributes. | |
1209 | .TP | |
1210 | .B \-r ID | |
1211 | When tracking, report the \fIRaw\fP value of Attribute \fBID\fP along | |
1212 | with its (normally reported) \fINormalized\fP value. \fBID\fP must be | |
1213 | a decimal integer in the range from 1 to 255. This Directive modifies | |
1214 | the behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives | |
1215 | and has no effect without one of them. This Directive may be given | |
1216 | multiple times. | |
1217 | ||
1218 | A common use of this Directive is to track the device Temperature | |
1219 | (often ID=194 or 231). | |
1220 | ||
1221 | .TP | |
1222 | .B \-R ID | |
1223 | When tracking, report whenever the \fIRaw\fP value of Attribute | |
1224 | \fBID\fP changes. (Normally \fBsmartd\fP only tracks/reports changes | |
1225 | of the \fINormalized\fP Attribute values.) \fBID\fP must be a decimal | |
1226 | integer in the range from 1 to 255. This Directive modifies the | |
1227 | behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives and | |
1228 | has no effect without one of them. This Directive may be given | |
1229 | multiple times. | |
1230 | ||
1231 | If this Directive is given, it automatically implies the \'\-r\' | |
1232 | Directive for the same Attribute, so that the Raw value of the | |
1233 | Attribute is reported. | |
1234 | ||
1235 | A common use of this Directive is to track the device Temperature | |
1236 | (often ID=194 or 231). It is also useful for understanding how | |
1237 | different types of system behavior affects the values of certain | |
1238 | Attributes. | |
1239 | ||
1240 | .TP | |
1241 | .B \-C ID | |
1242 | [ATA only] Report if the current number of pending sectors is | |
1243 | non-zero. Here \fBID\fP is the id number of the Attribute whose raw | |
1244 | value is the Current Pending Sector count. The allowed range of | |
1245 | \fBID\fP is 0 to 255 inclusive. To turn off this reporting, use | |
1246 | ID\ =\ 0. If the \fB\-C ID\fP option is not given, then it defaults to | |
1247 | \fB\-C 197\fP (since Attribute 197 is generally used to monitor | |
1248 | pending sectors). | |
1249 | ||
1250 | A pending sector is a disk sector (containing 512 bytes of your data) | |
1251 | which the device would like to mark as ``bad" and reallocate. | |
1252 | Typically this is because your computer tried to read that sector, and | |
1253 | the read failed because the data on it has been corrupted and has | |
1254 | inconsistent Error Checking and Correction (ECC) codes. This is | |
1255 | important to know, because it means that there is some unreadable data | |
1256 | on the disk. The problem of figuring out what file this data belongs | |
1257 | to is operating system and file system specific. You can typically | |
1258 | force the sector to reallocate by writing to it (translation: make the | |
1259 | device substitute a spare good sector for the bad one) but at the | |
1260 | price of losing the 512 bytes of data stored there. | |
1261 | ||
1262 | .TP | |
1263 | .B \-U ID | |
1264 | [ATA only] Report if the number of offline uncorrectable sectors is | |
1265 | non-zero. Here \fBID\fP is the id number of the Attribute whose raw | |
1266 | value is the Offline Uncorrectable Sector count. The allowed range of | |
1267 | \fBID\fP is 0 to 255 inclusive. To turn off this reporting, use | |
1268 | ID\ =\ 0. If the \fB\-U ID\fP option is not given, then it defaults to | |
1269 | \fB\-U 198\fP (since Attribute 198 is generally used to monitor | |
1270 | offline uncorrectable sectors). | |
1271 | ||
1272 | ||
1273 | An offline uncorrectable sector is a disk sector which was not | |
1274 | readable during an off\-line scan or a self\-test. This is important | |
1275 | to know, because if you have data stored in this disk sector, and you | |
1276 | need to read it, the read will fail. Please see the previous \'\-C\' | |
1277 | option for more details. | |
1278 | ||
1279 | .TP | |
1280 | .B \-F TYPE | |
1281 | [ATA only] Modifies the behavior of \fBsmartd\fP to compensate for | |
1282 | some known and understood device firmware bug. The arguments to this | |
1283 | Directive are exclusive, so that only the final Directive given is | |
1284 | used. The valid values are: | |
1285 | ||
1286 | .I none | |
1287 | \- Assume that the device firmware obeys the ATA specifications. This is | |
1288 | the default, unless the device has presets for \'\-F\' in the device | |
1289 | database. | |
1290 | ||
1291 | .I samsung | |
1292 | \- In some Samsung disks (example: model SV4012H Firmware Version: | |
1293 | RM100-08) some of the two- and four-byte quantities in the SMART data | |
1294 | structures are byte-swapped (relative to the ATA specification). | |
1295 | Enabling this option tells \fBsmartd\fP to evaluate these quantities | |
1296 | in byte-reversed order. Some signs that your disk needs this option | |
1297 | are (1) no self-test log printed, even though you have run self-tests; | |
1298 | (2) very large numbers of ATA errors reported in the ATA error log; | |
1299 | (3) strange and impossible values for the ATA error log timestamps. | |
1300 | ||
1301 | .I samsung2 | |
1302 | \- In more recent Samsung disks (firmware revisions ending in "\-23") the | |
1303 | number of ATA errors reported is byte swapped. Enabling this option | |
1304 | tells \fBsmartd\fP to evaluate this quantity in byte-reversed order. | |
1305 | ||
1306 | Note that an explicit \'\-F\' Directive will over-ride any preset | |
1307 | values for \'\-F\' (see the \'\-P\' option below). | |
1308 | ||
1309 | ||
1310 | [Please see the \fBsmartctl \-F\fP command-line option.] | |
1311 | ||
1312 | .TP | |
1313 | .B \-v N,OPTION | |
1314 | Modifies the labeling for Attribute N, for disks which use | |
1315 | non-standard Attribute definitions. This is useful in connection with | |
1316 | the Attribute tracking/reporting Directives. | |
1317 | ||
1318 | This Directive may appear multiple times. Valid arguments to this | |
1319 | Directive are: | |
1320 | ||
1321 | .I 9,minutes | |
1322 | \- Raw Attribute number 9 is power-on time in minutes. Its raw value | |
1323 | will be displayed in the form \'Xh+Ym\'. Here X is hours, and Y is | |
1324 | minutes in the range 0-59 inclusive. Y is always printed with two | |
1325 | digits, for example \'06\' or \'31\' or \'00\'. | |
1326 | ||
1327 | .I 9,seconds | |
1328 | \- Raw Attribute number 9 is power-on time in seconds. Its raw value | |
1329 | will be displayed in the form \'Xh+Ym+Zs\'. Here X is hours, Y is | |
1330 | minutes in the range 0-59 inclusive, and Z is seconds in the range | |
1331 | 0-59 inclusive. Y and Z are always printed with two digits, for | |
1332 | example \'06\' or \'31\' or \'00\'. | |
1333 | ||
1334 | .I 9,halfminutes | |
1335 | \- Raw Attribute number 9 is power-on time, measured in units of 30 | |
1336 | seconds. This format is used by some Samsung disks. Its raw value | |
1337 | will be displayed in the form \'Xh+Ym\'. Here X is hours, and Y is | |
1338 | minutes in the range 0-59 inclusive. Y is always printed with two | |
1339 | digits, for example \'06\' or \'31\' or \'00\'. | |
1340 | ||
1341 | .I 9,temp | |
1342 | \- Raw Attribute number 9 is the disk temperature in Celsius. | |
1343 | ||
1344 | .I 192,emergencyretractcyclect | |
1345 | \- Raw Attribute number 192 is the Emergency Retract Cycle Count. | |
1346 | ||
1347 | .I 193,loadunload | |
1348 | \- Raw Attribute number 193 contains two values. The first is the | |
1349 | number of load cycles. The second is the number of unload cycles. | |
1350 | The difference between these two values is the number of times that | |
1351 | the drive was unexpectedly powered off (also called an emergency | |
1352 | unload). As a rule of thumb, the mechanical stress created by one | |
1353 | emergency unload is equivalent to that created by one hundred normal | |
1354 | unloads. | |
1355 | ||
1356 | .I 194,10xCelsius | |
1357 | \- Raw Attribute number 194 is ten times the disk temperature in | |
1358 | Celsius. This is used by some Samsung disks (example: model SV1204H | |
1359 | with RK100-13 firmware). | |
1360 | ||
1361 | .I 194,unknown | |
1362 | \- Raw Attribute number 194 is NOT the disk temperature, and its | |
1363 | interpretation is unknown. This is primarily useful for the -P | |
1364 | (presets) Directive. | |
1365 | ||
1366 | .I 198,offlinescanuncsectorct | |
1367 | \- Raw Attribute number 198 is the Offline Scan UNC Sector Count. | |
1368 | ||
1369 | .I 200,writeerrorcount | |
1370 | \- Raw Attribute number 200 is the Write Error Count. | |
1371 | ||
1372 | .I 201,detectedtacount | |
1373 | \- Raw Attribute number 201 is the Detected TA Count. | |
1374 | ||
1375 | .I 220,temp | |
1376 | \- Raw Attribute number 220 is the disk temperature in Celsius. | |
1377 | ||
1378 | Note: a table of hard drive models, listing which Attribute | |
1379 | corresponds to temperature, can be found at: | |
1380 | \fBhttp://www.guzu.net/linux/hddtemp.db\fP | |
1381 | ||
1382 | .I N,raw8 | |
1383 | \- Print the Raw value of Attribute N as six 8-bit unsigned base-10 | |
1384 | integers. This may be useful for decoding the meaning of the Raw | |
1385 | value. The form \'N,raw8\' prints Raw values for ALL Attributes in this | |
1386 | form. The form (for example) \'123,raw8\' only prints the Raw value for | |
1387 | Attribute 123 in this form. | |
1388 | ||
1389 | .I N,raw16 | |
1390 | \- Print the Raw value of Attribute N as three 16-bit unsigned base-10 | |
1391 | integers. This may be useful for decoding the meaning of the Raw | |
1392 | value. The form \'N,raw16\' prints Raw values for ALL Attributes in this | |
1393 | form. The form (for example) \'123,raw16\' only prints the Raw value for | |
1394 | Attribute 123 in this form. | |
1395 | ||
1396 | .I N,raw48 | |
1397 | \- Print the Raw value of Attribute N as a 48-bit unsigned base-10 | |
1398 | integer. This may be useful for decoding the meaning of the Raw | |
1399 | value. The form \'N,raw48\' prints Raw values for ALL Attributes in | |
1400 | this form. The form (for example) \'123,raw48\' only prints the Raw | |
1401 | value for Attribute 123 in this form. | |
1402 | ||
1403 | .TP | |
1404 | .B \-P TYPE | |
1405 | Specifies whether | |
1406 | \fBsmartd\fP | |
1407 | should use any preset options that are available for this drive. The | |
1408 | valid arguments to this Directive are: | |
1409 | ||
1410 | .I use | |
1411 | \- use any presets that are available for this drive. This is the default. | |
1412 | ||
1413 | .I ignore | |
1414 | \- do not use any presets for this drive. | |
1415 | ||
1416 | .I show | |
1417 | \- show the presets listed for this drive in the database. | |
1418 | ||
1419 | .I showall | |
1420 | \- show the presets that are available for all drives and then exit. | |
1421 | ||
1422 | [Please see the | |
1423 | .B smartctl \-P | |
1424 | command-line option.] | |
1425 | ||
1426 | .TP | |
1427 | .B \-a | |
1428 | Equivalent to turning on all of the following Directives: | |
1429 | .B \'\-H\' | |
1430 | to check the SMART health status, | |
1431 | .B \'\-f\' | |
1432 | to report failures of Usage (rather than Prefail) Attributes, | |
1433 | .B \'\-t\' | |
1434 | to track changes in both Prefailure and Usage Attributes, | |
1435 | .B \'\-l\ selftest\' | |
1436 | to report increases in the number of Self-Test Log errors, | |
1437 | .B \'\-l\ error\' | |
1438 | to report increases in the number of ATA errors, | |
1439 | .B \'\-C 197\' | |
1440 | to report nonzero values of the current pending sector count, and | |
1441 | .B \'\-U 198\' | |
1442 | to report nonzero values of the offline pending sector count. | |
1443 | ||
1444 | Note that \-a is the default for ATA devices. If none of these other | |
1445 | Directives is given, then \-a is assumed. | |
1446 | ||
1447 | .TP | |
1448 | .B # | |
1449 | Comment: ignore the remainder of the line. | |
1450 | .TP | |
1451 | .B \e | |
1452 | Continuation character: if this is the last non-white or non-comment | |
1453 | character on a line, then the following line is a continuation of the current | |
1454 | one. | |
1455 | .PP | |
1456 | If you are not sure which Directives to use, I suggest experimenting | |
1457 | for a few minutes with | |
1458 | .B smartctl | |
1459 | to see what SMART functionality your disk(s) support(s). If you do | |
1460 | not like voluminous syslog messages, a good choice of | |
1461 | \fBsmartd\fP | |
1462 | configuration file Directives might be: | |
1463 | .nf | |
1464 | .B \-H \-l\ selftest \-l\ error \-f. | |
1465 | .fi | |
1466 | If you want more frequent information, use: | |
1467 | .B -a. | |
1468 | ||
1469 | .TP | |
1470 | .B ADDITIONAL DETAILS ABOUT DEVICESCAN | |
1471 | If the first non-comment entry in the configuration file is the text | |
1472 | string \fBDEVICESCAN\fP in capital letters, then \fBsmartd\fP will | |
1473 | ignore any remaining lines in the configuration file, and will scan | |
1474 | for devices. | |
1475 | ||
1476 | If \fBDEVICESCAN\fP is not followed by any Directives, then smartd | |
1477 | will scan for both ATA and SCSI devices, and will monitor all possible | |
1478 | SMART properties of any devices that are found. | |
1479 | ||
1480 | \fBDEVICESCAN\fP may optionally be followed by any valid Directives, | |
1481 | which will be applied to all devices that are found in the scan. For | |
1482 | example | |
1483 | .nf | |
1484 | .B DEVICESCAN -m root@example.com | |
1485 | .fi | |
1486 | will scan for all devices, and then monitor them. It will send one | |
1487 | email warning per device for any problems that are found. | |
1488 | .nf | |
1489 | .B DEVICESCAN -d ata -m root@example.com | |
1490 | .fi | |
1491 | will do the same, but restricts the scan to ATA devices only. | |
1492 | .nf | |
1493 | .B DEVICESCAN -H -d ata -m root@example.com | |
1494 | .fi | |
1495 | will do the same, but only monitors the SMART health status of the | |
1496 | devices, (rather than the default \-a, which monitors all SMART | |
1497 | properties). | |
1498 | ||
1499 | .TP | |
1500 | .B EXAMPLES OF SHELL SCRIPTS FOR \'\-M exec\' | |
1501 | These are two examples of shell scripts that can be used with the \'\-M | |
1502 | exec PATH\' Directive described previously. The paths to these scripts | |
1503 | and similar executables is the PATH argument to the \'\-M exec PATH\' | |
1504 | Directive. | |
1505 | ||
1506 | Example 1: This script is for use with \'\-m ADDRESS -M exec PATH\'. It appends | |
1507 | the output of | |
1508 | .B smartctl -a | |
1509 | to the output of the smartd email warning message and sends it to ADDRESS. | |
1510 | ||
1511 | .nf | |
1512 | \fB | |
1513 | #! /bin/bash | |
1514 | ||
1515 | # Save the email message (STDIN) to a file: | |
1516 | cat > /root/msg | |
1517 | ||
1518 | # Append the output of smartctl -a to the message: | |
1519 | /usr/local/sbin/smartctl -a -d $SMART_DEVICETYPE $SMARTD_DEVICE >> /root/msg | |
1520 | ||
1521 | # Now email the message to the user at address ADD: | |
1522 | /bin/mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS < /root/msg | |
1523 | \fP | |
1524 | .fi | |
1525 | ||
1526 | Example 2: This script is for use with \'\-m <nomailer> \-M exec | |
1527 | PATH\'. It warns all users about a disk problem, waits 30 seconds, and | |
1528 | then powers down the machine. | |
1529 | ||
1530 | .nf | |
1531 | \fB | |
1532 | #! /bin/bash | |
1533 | ||
1534 | # Warn all users of a problem | |
1535 | wall \'Problem detected with disk: \' "$SMARTD_DEVICESTRING" | |
1536 | wall \'Warning message from smartd is: \' "$SMARTD_MESSAGE" | |
1537 | wall \'Shutting down machine in 30 seconds... \' | |
1538 | ||
1539 | # Wait half a minute | |
1540 | sleep 30 | |
1541 | ||
1542 | # Power down the machine | |
1543 | /sbin/shutdown -hf now | |
1544 | \fP | |
1545 | .fi | |
1546 | ||
1547 | Some example scripts are distributed with the smartmontools package, | |
1548 | in /usr/local/share/doc/smartmontools-5.1/examplescripts/. | |
1549 | ||
1550 | Please note that these scripts typically run as root, so any files | |
1551 | that they read/write should not be writable by ordinary users or | |
1552 | reside in directories like /tmp that are writable by ordinary users | |
1553 | and may expose your system to symlink attacks. | |
1554 | ||
1555 | As previously described, if the scripts write to STDOUT or STDERR, | |
1556 | this is interpreted as indicating that there was an internal error | |
1557 | within the script, and a snippet of STDOUT/STDERR is logged to SYSLOG. | |
1558 | The remainder is flushed. | |
1559 | ||
1560 | .\" ENDINCLUDE | |
1561 | .\" DO NOT MODIFY THIS OR PREVIOUS/NEXT LINES. THIS DEFINES THE | |
1562 | .\" END OF THE INCLUDE SECTION FOR smartd.conf.5 | |
1563 | ||
1564 | .SH NOTES | |
1565 | \fBsmartd\fP | |
1566 | will make log entries at loglevel | |
1567 | .B LOG_INFO | |
1568 | if the Normalized SMART Attribute values have changed, as reported using the | |
1569 | .B \'\-t\', \'\-p\', | |
1570 | or | |
1571 | .B \'\-u\' | |
1572 | Directives. For example: | |
1573 | .nf | |
1574 | .B \'Device: /dev/hda, SMART Attribute: 194 Temperature_Celsius changed from 94 to 93\' | |
1575 | .fi | |
1576 | Note that in this message, the value given is the \'Normalized\' not the \'Raw\' | |
1577 | Attribute value (the disk temperature in this case is about 22 | |
1578 | Celsius). The | |
1579 | .B \'-R\' | |
1580 | and | |
1581 | .B \'-r\' | |
1582 | Directives modify this behavior, so that the information is printed | |
1583 | with the Raw values as well, for example: | |
1584 | .nf | |
1585 | .B \'Device: /dev/hda, SMART Attribute: 194 Temperature_Celsius changed from 94 [Raw 22] to 93 [Raw 23]\' | |
1586 | .fi | |
1587 | Here the Raw values are the actual disk temperatures in Celsius. The | |
1588 | way in which the Raw values are printed, and the names under which the | |
1589 | Attributes are reported, is governed by the various | |
1590 | .B \'-v Num,Description\' | |
1591 | Directives described previously. | |
1592 | ||
1593 | Please see the | |
1594 | .B smartctl | |
1595 | manual page for further explanation of the differences between | |
1596 | Normalized and Raw Attribute values. | |
1597 | ||
1598 | \fBsmartd\fP | |
1599 | will make log entries at loglevel | |
1600 | .B LOG_CRIT | |
1601 | if a SMART Attribute has failed, for example: | |
1602 | .nf | |
1603 | .B \'Device: /dev/hdc, Failed SMART Attribute: 5 Reallocated_Sector_Ct\' | |
1604 | .fi | |
1605 | This loglevel is used for reporting enabled by the | |
1606 | .B \'\-H\', \-f\', \'\-l\ selftest\', | |
1607 | and | |
1608 | .B \'\-l\ error\' | |
1609 | Directives. Entries reporting failure of SMART Prefailure Attributes | |
1610 | should not be ignored: they mean that the disk is failing. Use the | |
1611 | .B smartctl | |
1612 | utility to investigate. | |
1613 | ||
1614 | Under Solaris with the default \fB/etc/syslog.conf\fP configuration, | |
1615 | messages below loglevel \fBLOG_NOTICE\fP will \fBnot\fP be recorded. | |
1616 | Hence all \fBsmartd\fP messages with loglevel \fBLOG_INFO\fP will be | |
1617 | lost. If you want to use the existing daemon facility to log all | |
1618 | messages from \fBsmartd\fP, you should change \fB/etc/syslog.conf\fP | |
1619 | from: | |
1620 | .nf | |
1621 | ...;daemon.notice;... /var/adm/messages | |
1622 | .fi | |
1623 | to read: | |
1624 | .nf | |
1625 | ...;daemon.info;... /var/adm/messages | |
1626 | .fi | |
1627 | Alternatively, you can use a local facility to log messages: please | |
1628 | see the \fBsmartd\fP '-l' command-line option described above. | |
1629 | ||
1630 | On Cygwin and Windows, the log messages are written to the event log | |
1631 | or to a file. See documentation of the '-l FACILITY' option above for | |
1632 | details. | |
1633 | ||
1634 | On Windows, the following built-in commands can be used to control | |
1635 | \fBsmartd\fP, if running as a daemon: | |
1636 | ||
1637 | \'\fBsmartd status\fP\' \- check status | |
1638 | ||
1639 | \'\fBsmartd stop\fP\' \- stop smartd | |
1640 | ||
1641 | \'\fBsmartd reload\fP\' \- reread config file | |
1642 | ||
1643 | \'\fBsmartd restart\fP\' \- restart smartd | |
1644 | ||
1645 | \'\fBsmartd sigusr1\fP\' \- check disks now | |
1646 | ||
1647 | \'\fBsmartd sigusr2\fP\' \- toggle debug mode | |
1648 | ||
1649 | On WinNT4/2000/XP, \fBsmartd\fP can also be run as a Windows service: | |
1650 | ||
1651 | ||
1652 | The Cygwin Version of \fBsmartd\fP can be run as a service via the | |
1653 | cygrunsrv tool. The start-up script provides Cygwin-specific commands | |
1654 | to install and remove the service: | |
1655 | .nf | |
1656 | .B /usr/local/etc/rc.d/init.d/smartd install [options] | |
1657 | .B /usr/local/etc/rc.d/init.d/smartd remove | |
1658 | .fi | |
1659 | The service can be started and stopped by the start-up script as usual | |
1660 | (see \fBEXAMPLES\fP above). | |
1661 | ||
1662 | ||
1663 | The Windows Version of \fBsmartd\fP has buildin support for services: | |
1664 | ||
1665 | \'\fBsmartd install [options]\fP\' installs a service | |
1666 | named "smartd" (display name "SmartD Service") using the command line | |
1667 | \'/installpath/smartd.exe --service [options]\'. | |
1668 | ||
1669 | \'\fBsmartd remove\fP\' can later be used to remove the service entry | |
1670 | from registry. | |
1671 | ||
1672 | Upon startup, the smartd service changes the working directory | |
1673 | to its own installation path. If smartd.conf and blat.exe are stored | |
1674 | in this directory, no \'-c\' option and \'-M exec\' directive is needed. | |
1675 | ||
1676 | The debug mode (\'-d\', \'-q onecheck\') does not work if smartd is | |
1677 | running as service. | |
1678 | ||
1679 | The service can be controlled as usual with Windows commands \'net\' | |
1680 | or \'sc\' (\'\fBnet start smartd\fP\', \'\fBnet stop smartd\fP\'). | |
1681 | ||
1682 | Pausing the service (\'\fBnet pause smartd\fP\') sets the interval between | |
1683 | disk checks (\'-i N\') to infinite. | |
1684 | ||
1685 | Continuing the paused service (\'\fBnet continue smartd\fP\') resets the | |
1686 | interval and rereads the configuration file immediately (like \fBSIGHUP\fP): | |
1687 | ||
1688 | Continuing a still running service (\'\fBnet continue smartd\fP\' without | |
1689 | preceding \'\fBnet pause smartd\fP\') does not reread configuration but | |
1690 | checks disks immediately (like \fBSIGUSR1\fP). | |
1691 | ||
1692 | .SH LOG TIMESTAMP TIMEZONE | |
1693 | ||
1694 | When \fBsmartd\fP makes log entries, these are time-stamped. The time | |
1695 | stamps are in the computer's local time zone, which is generally set | |
1696 | using either the environment variable \'\fBTZ\fP\' or using a | |
1697 | time-zone file such as \fB/etc/localtime\fP. You may wish to change | |
1698 | the timezone while \fBsmartd\fP is running (for example, if you carry | |
1699 | a laptop to a new time-zone and don't reboot it). Due to a bug in the | |
1700 | \fBtzset(3)\fP function of many unix standard C libraries, the | |
1701 | time-zone stamps of \fBsmartd\fP might not change. For some systems, | |
1702 | \fBsmartd\fP will work around this problem \fIif\fP the time-zone is | |
1703 | set using \fB/etc/localtime\fP. The work-around \fIfails\fP if the | |
1704 | time-zone is set using the \'\fBTZ\fP\' variable (or a file that it | |
1705 | points to). | |
1706 | ||
1707 | ||
1708 | .SH RETURN VALUES | |
1709 | The return value (exit status) of | |
1710 | \fBsmartd\fP | |
1711 | can have the following values: | |
1712 | .TP | |
1713 | .B 0: | |
1714 | Daemon startup successful, or \fBsmartd\fP was killed by a SIGTERM (or in debug mode, a SIGQUIT). | |
1715 | .TP | |
1716 | .B 1: | |
1717 | Commandline did not parse. | |
1718 | .TP | |
1719 | .B 2: | |
1720 | There was a syntax error in the config file. | |
1721 | .TP | |
1722 | .B 3: | |
1723 | Forking the daemon failed. | |
1724 | .TP | |
1725 | .B 4: | |
1726 | Couldn\'t create PID file. | |
1727 | .TP | |
1728 | .B 5: | |
1729 | Config file does not exist (only returned in conjunction with the \'-c\' option). | |
1730 | .TP | |
1731 | .B 6: | |
1732 | Config file exists, but cannot be read. | |
1733 | .TP | |
1734 | .B 8: | |
1735 | \fBsmartd\fP | |
1736 | ran out of memory during startup. | |
1737 | .TP | |
1738 | .B 9: | |
1739 | A compile time constant of\fB smartd\fP was too small. This can be caused by an | |
1740 | excessive number of disks, or by lines in \fB /usr/local/etc/smartd.conf\fP that are too long. | |
1741 | Please report this problem to \fB smartmontools-support@lists.sourceforge.net\fP. | |
1742 | .TP | |
1743 | .B 10 | |
1744 | An inconsistency was found in \fBsmartd\fP\'s internal data | |
1745 | structures. This should never happen. It must be due to either a | |
1746 | coding or compiler bug. \fIPlease\fP report such failures to | |
1747 | smartmontools-support@lists.sourceforge.net. | |
1748 | .TP | |
1749 | .B 16: | |
1750 | A device explicitly listed in | |
1751 | .B /usr/local/etc/smartd.conf | |
1752 | can\'t be monitored. | |
1753 | .TP | |
1754 | .B 17: | |
1755 | \fBsmartd\fP | |
1756 | didn\'t find any devices to monitor. | |
1757 | .TP | |
1758 | .B 254: | |
1759 | When in daemon mode, | |
1760 | \fBsmartd\fP | |
1761 | received a SIGINT or SIGQUIT. (Note that in debug mode, SIGINT has | |
1762 | the same effect as SIGHUP, and makes \fBsmartd\fP reload its | |
1763 | configuration file. SIGQUIT has the same effect as SIGTERM and causes | |
1764 | \fBsmartd\fP to exit with zero exit status. | |
1765 | .TP | |
1766 | .B 132 and above | |
1767 | \fBsmartd\fP | |
1768 | was killed by a signal that is not explicitly listed above. The exit | |
1769 | status is then 128 plus the signal number. For example if | |
1770 | \fBsmartd\fP | |
1771 | is killed by SIGKILL (signal 9) then the exit status is 137. | |
1772 | ||
1773 | .PP | |
1774 | .SH AUTHOR | |
1775 | \fBBruce Allen\fP smartmontools-support@lists.sourceforge.net | |
1776 | .fi | |
1777 | University of Wisconsin \- Milwaukee Physics Department | |
1778 | ||
1779 | .PP | |
1780 | .SH CONTRIBUTORS | |
1781 | The following have made large contributions to smartmontools: | |
1782 | .nf | |
1783 | \fBCasper Dik\fP (Solaris SCSI interface) | |
1784 | \fBChristian Franke\fP (Windows interface and Cygwin package) | |
1785 | \fBDouglas Gilbert\fP (SCSI subsystem) | |
1786 | \fBGuido Guenther\fP (Autoconf/Automake packaging) | |
1787 | \fBGeoffrey Keating\fP (Darwin ATA interface) | |
1788 | \fBEduard Martinescu\fP (FreeBSD interface) | |
1789 | \fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list) | |
1790 | \fBKeiji Sawada\fP (Solaris ATA interface) | |
1791 | \fBSergey Svishchev\fP (NetBSD interface) | |
1792 | \fBDavid Snyder and Sergey Svishchev\fP (OpenBSD interface) | |
1793 | \fBPhil Williams\fP (User interface and drive database) | |
1794 | .fi | |
1795 | Many other individuals have made smaller contributions and corrections. | |
1796 | ||
1797 | .PP | |
1798 | .SH CREDITS | |
1799 | .fi | |
1800 | This code was derived from the smartsuite package, written by Michael | |
1801 | Cornwell, and from the previous ucsc smartsuite package. It extends | |
1802 | these to cover ATA-5 disks. This code was originally developed as a | |
1803 | Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory | |
1804 | (now part of the Storage Systems Research Center), Jack Baskin School | |
1805 | of Engineering, University of California, Santa | |
1806 | Cruz. \fBhttp://ssrc.soe.ucsc.edu/\fP . | |
1807 | .SH | |
1808 | HOME PAGE FOR SMARTMONTOOLS: | |
1809 | .fi | |
1810 | Please see the following web site for updates, further documentation, bug | |
1811 | reports and patches: \fBhttp://smartmontools.sourceforge.net/\fP | |
1812 | ||
1813 | .SH SEE ALSO: | |
1814 | \fBsmartd.conf\fP(5), \fBsmartctl\fP(8), \fBsyslogd\fP(8), | |
1815 | \fBsyslog.conf\fP(5), \fBbadblocks\fP(8), \fBide\-smart\fP(8), \fBregex\fP(7). | |
1816 | ||
1817 | .SH | |
1818 | REFERENCES FOR SMART | |
1819 | .fi | |
1820 | An introductory article about smartmontools is \fIMonitoring Hard | |
1821 | Disks with SMART\fP, by Bruce Allen, Linux Journal, January 2004, | |
1822 | pages 74-77. This is \fBhttp://www.linuxjournal.com/article.php?sid=6983\fP | |
1823 | online. | |
1824 | ||
1825 | If you would like to understand better how SMART works, and what it | |
1826 | does, a good place to start is with Sections 4.8 and 6.54 of the first | |
1827 | volume of the \'AT Attachment with Packet Interface-7\' (ATA/ATAPI-7) | |
1828 | specification. This documents the SMART functionality which the | |
1829 | \fBsmartmontools\fP utilities provide access to. You can find | |
1830 | Revision 4b of this document at | |
1831 | \fBhttp://www.t13.org/docs2004/d1532v1r4b-ATA-ATAPI-7.pdf\fP . | |
1832 | Earlier and later versions of this Specification are available from | |
1833 | the T13 web site \fBhttp://www.t13.org/\fP . | |
1834 | ||
1835 | .fi | |
1836 | The functioning of SMART was originally defined by the SFF-8035i | |
1837 | revision 2 and the SFF-8055i revision 1.4 specifications. These are | |
1838 | publications of the Small Form Factors (SFF) Committee. Links to | |
1839 | these documents may be found in the References section of the | |
1840 | smartmontools home page at \fBhttp://smartmontools.sourceforge.net/#references\fP . | |
1841 | ||
1842 | .SH | |
1843 | CVS ID OF THIS PAGE: | |
1844 | $Id: smartd.8.in,v 1.100 2006/04/12 13:55:44 ballen4705 Exp $ |