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