]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - smartd.8.in
New upstream version 6.6
[mirror_smartmontools-debian.git] / smartd.8.in
CommitLineData
832b75ed 1.ig
a86ec89e 2Copyright (C) 2002-10 Bruce Allen
f9e10201 3Copyright (C) 2004-17 Christian Franke
ee38a438 4
f9e10201 5$Id: smartd.8.in 4576 2017-10-29 16:41:44Z chrfranke $
832b75ed
GG
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
ee38a438
GI
11
12You should have received a copy of the GNU General Public License
13(for example COPYING); If not, see <http://www.gnu.org/licenses/>.
14
15This code was originally developed as a Senior Thesis by Michael Cornwell
16at the Concurrent Systems Laboratory (now part of the Storage Systems
17Research Center), Jack Baskin School of Engineering, University of
18California, Santa Cruz. http://ssrc.soe.ucsc.edu/
19
832b75ed 20..
f9e10201
JD
21.\" Macros borrowed from pages generated with Pod::Man
22.de Sp \" Vertical space (when we can't use .PP)
23.if t .sp 0.4v
24.if n .sp
25..
26.de Vb \" Begin verbatim text
27.ft CW
28.nf
29.ne \\$1
30..
31.de Ve \" End verbatim text
32.ft R
33.fi
34..
35.\" Use groff extension \(aq (apostrophe quote, ASCII 0x27) if possible
36.ie \n(.g .ds Aq \(aq
37.el .ds Aq '
a86ec89e 38.TH SMARTD 8 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
832b75ed
GG
39.SH NAME
40\fBsmartd\fP \- SMART Disk Monitoring Daemon
41
42.SH SYNOPSIS
43.B smartd [options]
44
832b75ed 45.SH DESCRIPTION
d008864d
GI
46.\" %IF NOT OS ALL
47.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
48.\"! It does not contain info specific to other platforms.]
49.\"! .PP
50.\" %ENDIF NOT OS ALL
ee38a438
GI
51\fBsmartd\fP is a daemon that monitors the Self-Monitoring, Analysis and
52Reporting Technology (SMART) system built into most ATA/SATA and SCSI/SAS
53hard drives and solid-state drives.
54The purpose of SMART is to monitor the reliability of the hard drive
55and predict drive failures, and to carry out different types of drive
56self-tests.
57This version of \fBsmartd\fP is compatible with
d2e702cf 58ACS-3, ACS-2, ATA8-ACS, ATA/ATAPI-7 and earlier standards
ee38a438 59(see \fBREFERENCES\fP below).
f9e10201 60.PP
832b75ed 61\fBsmartd\fP will attempt to enable SMART monitoring on ATA devices
f9e10201 62(equivalent to \fBsmartctl \-s on\fP) and polls these and SCSI devices
832b75ed
GG
63every 30 minutes (configurable), logging SMART errors and changes of
64SMART Attributes via the SYSLOG interface. The default location for
e9583e0c
GI
65these SYSLOG notifications and warnings is system-dependent
66(typically \fB/var/log/messages\fP or \fB/var/log/syslog\fP).
f9e10201 67To change this default location, please see the \*(Aq\-l\*(Aq
832b75ed 68command-line option described below.
f9e10201 69.PP
832b75ed
GG
70In addition to logging to a file, \fBsmartd\fP can also be configured
71to send email warnings if problems are detected. Depending upon the
ee38a438 72type of problem, you may want to run self-tests on the disk, back up
f9e10201 73the disk, replace the disk, or use a manufacturer's utility to force
832b75ed
GG
74reallocation of bad or unreadable disk sectors. If disk problems are
75detected, please see the \fBsmartctl\fP manual page and the
76\fBsmartmontools\fP web page/FAQ for further guidance.
f9e10201 77.PP
832b75ed
GG
78If you send a \fBUSR1\fP signal to \fBsmartd\fP it will immediately
79check the status of the disks, and then return to polling the disks
f9e10201
JD
80every 30 minutes.
81See the \*(Aq\-i\*(Aq option below for additional details.
82.PP
832b75ed 83\fBsmartd\fP can be configured at start-up using the configuration
e9583e0c 84file \fB/usr/local/etc/smartd.conf\fP (Windows: \fBEXEDIR/smartd.conf\fP).
832b75ed
GG
85If the configuration file is subsequently modified, \fBsmartd\fP
86can be told to re-read the configuration file by sending it a
87\fBHUP\fP signal, for example with the command:
d2e702cf 88.br
f9e10201 89\fBkillall \-HUP smartd\fP.
d2e702cf 90.br
d008864d 91.\" %IF OS Windows
832b75ed 92(Windows: See NOTES below.)
d008864d 93.\" %ENDIF OS Windows
f9e10201 94.PP
832b75ed 95On startup, if \fBsmartd\fP finds a syntax error in the configuration
f9e10201 96file, it will print an error message and then exit. However if
832b75ed
GG
97\fBsmartd\fP is already running, then is told with a \fBHUP\fP signal
98to re-read the configuration file, and then find a syntax error in
99this file, it will print an error message and then continue, ignoring
100the contents of the (faulty) configuration file, as if the \fBHUP\fP
101signal had never been received.
f9e10201 102.PP
832b75ed 103When \fBsmartd\fP is running in debug mode, the \fBINT\fP signal
ee38a438 104(normally generated from a shell with CONTROL-C) is treated in the
832b75ed 105same way as a \fBHUP\fP signal: it makes \fBsmartd\fP reload its
f9e10201
JD
106configuration file.
107To exit \fBsmartd\fP use CONTROL-\e.
d008864d 108.\" %IF OS Windows
ee38a438 109(Windows: CONTROL-Break).
d008864d 110.\" %ENDIF OS Windows
f9e10201 111.PP
832b75ed
GG
112On startup, in the absence of the configuration file
113\fB/usr/local/etc/smartd.conf\fP, the \fBsmartd\fP daemon first scans for all
114devices that support SMART. The scanning is done as follows:
d008864d 115.\" %IF OS Linux
832b75ed 116.IP \fBLINUX:\fP 9
f9e10201
JD
117Examine all entries \fB"/dev/hd[a\-t]"\fP for IDE/ATA
118devices, and \fB"/dev/sd[a\-z]"\fP, \fB"/dev/sd[a\-c][a\-z]"\fP
a86ec89e 119for ATA/SATA or SCSI/SAS devices.
ee38a438 120Disks behind RAID controllers are not included.
f9e10201 121.Sp
a86ec89e 122[NEW EXPERIMENTAL SMARTD FEATURE]
f9e10201 123If directive \*(Aq\-d nvme\*(Aq
a86ec89e 124.\" %IF ENABLE_NVME_DEVICESCAN
f9e10201 125or no \*(Aq\-d\*(Aq directive
a86ec89e 126.\" %ENDIF ENABLE_NVME_DEVICESCAN
f9e10201 127is specified, examine all entries \fB"/dev/nvme[0\-99]"\fP for NVMe devices.
d008864d
GI
128.\" %ENDIF OS Linux
129.\" %IF OS FreeBSD
832b75ed 130.IP \fBFREEBSD:\fP 9
f9e10201
JD
131Authoritative list of disk devices is obtained from SCSI (CAM) and ATA
132subsystems.
ee38a438 133Disks behind RAID controllers are not included.
d008864d
GI
134.\" %ENDIF OS FreeBSD
135.\" %IF OS NetBSD OpenBSD
832b75ed 136.IP \fBNETBSD/OPENBSD:\fP 9
f9e10201
JD
137Authoritative list of disk devices is obtained from sysctl
138\*(Aqhw.disknames\*(Aq.
d008864d
GI
139.\" %ENDIF OS NetBSD OpenBSD
140.\" %IF OS Solaris
832b75ed 141.IP \fBSOLARIS:\fP 9
f4e463df 142Examine all entries \fB"/dev/rdsk/*s0"\fP for IDE/ATA and SCSI disk
832b75ed 143devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
d008864d
GI
144.\" %ENDIF OS Solaris
145.\" %IF OS Darwin
832b75ed
GG
146.IP \fBDARWIN:\fP 9
147The IOService plane is scanned for ATA block storage devices.
d008864d 148.\" %ENDIF OS Darwin
d008864d 149.\" %IF OS Windows Cygwin
ee38a438
GI
150.IP \fBWINDOWS\fP: 9
151Examine all entries \fB"/dev/sd[a\-z]"\fP, \fB"/dev/sd[a\-c][a\-z]"\fP
152and \fB"/dev/sdd[a\-x]"\fP ("\\\\.\\PhysicalDrive[0\-127]") for
153IDE/(S)ATA and SCSI disk devices.
f9e10201 154.Sp
4d59bff9 155If a 3ware 9000 controller is installed, examine all entries
f9e10201
JD
156\fB"/dev/sdX,N"\fP for the first logical drive (\*(Aqunit\*(Aq
157\fB"/dev/sdX"\fP) and all physical disks (\*(Aqports\*(Aq \fB",N"\fP)
158detected behind this controller.
159Same for a second controller if present.
160.Sp
161If directive \*(Aq\-d csmi\*(Aq or no \*(Aq\-d\*(Aq directive is specified,
f4e463df
GI
162examine all entries \fB"/dev/csmi[0\-9],N"\fP for drives behind an Intel
163ICHxR controller with RST driver.
f9e10201 164.Sp
ee38a438 165Disks behind Areca RAID controllers are not included.
f9e10201 166.Sp
a86ec89e 167[NEW EXPERIMENTAL SMARTD FEATURE]
f9e10201 168If directive \*(Aq\-d nvme\*(Aq
a86ec89e 169.\" %IF ENABLE_NVME_DEVICESCAN
f9e10201 170or no \*(Aq\-d\*(Aq directive
a86ec89e 171.\" %ENDIF ENABLE_NVME_DEVICESCAN
f9e10201
JD
172is specified, examine all entries \fB"/dev/sd[...]"\fP (see above)
173and all entries \fB"/dev/nvme[0\-9]"\fP for NVMe devices.
d008864d 174.\" %ENDIF OS Windows Cygwin
832b75ed
GG
175.PP
176\fBsmartd\fP then monitors
f9e10201 177for \fIall\fP possible SMART errors (corresponding to the \*(Aq\-a\*(Aq
ee38a438 178Directive in the configuration file; see the \fBsmartd.conf\fP(5) man page).
f9e10201 179.Sp
d2e702cf 180.SH OPTIONS
832b75ed 181.TP
2127e193 182.B \-A PREFIX, \-\-attributelog=PREFIX
ee38a438 183Writes \fBsmartd\fP attribute information (normalized and raw
f9e10201
JD
184attribute values) to files \*(AqPREFIX\*(Aq\*(AqMODEL\-SERIAL.ata.csv\*(Aq
185or \*(AqPREFIX\*(Aq\*(AqVENDOR\-MODEL\-SERIAL.scsi.csv\*(Aq.
186At each check cycle attributes are logged as a line of semicolon separated
187triplets of the form "attribute-ID;attribute-norm-value;attribute-raw-value;".
188For SCSI devices error counters and temperature recorded in the form
189"counter-name;counter-value;".
cfbba5b9 190Each line is led by a date string of the form "yyyy-mm-dd HH:MM:SS" (in UTC).
f9e10201 191.Sp
d008864d 192.\" %IF ENABLE_ATTRIBUTELOG
2127e193 193If this option is not specified, attribute information is written to files
f9e10201 194\*(Aq/usr/local/var/lib/smartmontools/attrlog.MODEL\-SERIAL.ata.csv\*(Aq.
2127e193 195To disable attribute log files, specify this option with an empty string
f9e10201 196argument: \*(Aq\-A ""\*(Aq.
d008864d 197.\" %ENDIF ENABLE_ATTRIBUTELOG
2127e193
GI
198MODEL and SERIAL are build from drive identify information, invalid
199characters are replaced by underline.
f9e10201
JD
200.Sp
201If the PREFIX has the form \*(Aq/path/dir/\*(Aq (e.g.\&
202\*(Aq/var/lib/smartd/\*(Aq), then files \*(AqMODEL\-SERIAL.ata.csv\*(Aq are
203created in directory \*(Aq/path/dir\*(Aq.
204If the PREFIX has the form \*(Aq/path/name\*(Aq (e.g.\&
205\*(Aq/var/lib/misc/attrlog\-\*(Aq),
206then files \*(AqnameMODEL\-SERIAL.ata.csv\*(Aq are created in directory
207\*(Aq/path/\*(Aq.
2127e193 208The path must be absolute, except if debug mode is enabled.
2127e193
GI
209.TP
210.B \-B [+]FILE, \-\-drivedb=[+]FILE
cfbba5b9 211[ATA only] Read the drive database from FILE. The new database replaces
f9e10201
JD
212the built in database by default. If \*(Aq+\*(Aq is specified, then the new
213entries prepend the built in entries.
bed94269 214Please see the \fBsmartctl\fP(8) man page for further details.
2127e193
GI
215.TP
216.B \-c FILE, \-\-configfile=FILE
832b75ed 217Read \fBsmartd\fP configuration Directives from FILE, instead of from
f9e10201
JD
218the default location \fB/usr/local/etc/smartd.conf\fP
219(Windows: \fBEXEDIR/smartd.conf\fP).
832b75ed 220If FILE does \fBnot\fP exist, then \fBsmartd\fP will print an error
f9e10201
JD
221message and exit with nonzero status.
222Thus, \*(Aq\-c /usr/local/etc/smartd.conf\*(Aq can be used to verify the
223existence of the default configuration file.
224.Sp
225By using \*(Aq\-\*(Aq for FILE, the configuration is read from standard input.
226This is useful for commands like:
227.br
a86ec89e 228.B echo /dev/sdb \-m user@home \-M test | smartd \-c \- \-q onecheck
f9e10201 229.br
832b75ed 230to perform quick and simple checks without a configuration file.
d008864d 231.\" %IF ENABLE_CAPABILITIES
a23d5117
GI
232.TP
233.B \-C, \-\-capabilities
a86ec89e
GI
234[Linux only] Use libcap-ng to drop unneeded Linux process \fBcapabilities\fP(7).
235The following capabilities are kept: CAP_SYS_ADMIN, CAP_SYS_RAWIO, CAP_MKNOD.
f9e10201 236.Sp
a23d5117 237Warning: Mail notification does not work when used.
d008864d 238.\" %ENDIF ENABLE_CAPABILITIES
832b75ed
GG
239.TP
240.B \-d, \-\-debug
f9e10201 241Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status
832b75ed 242information to STDOUT rather than logging it to SYSLOG and does not
d2e702cf 243\fBfork\fP(2) into the background and detach from the controlling
832b75ed
GG
244terminal. In this mode, \fBsmartd\fP also prints more verbose
245information about what it is doing than when operating in "daemon"
f9e10201 246mode. In this mode, the \fBINT\fP signal (normally generated from a
ee38a438 247terminal with CONTROL-C) makes \fBsmartd\fP reload its configuration
832b75ed 248file. Please use CONTROL-\e to exit
d008864d 249.\" %IF OS Windows
ee38a438 250(Windows: CONTROL-Break).
f9e10201 251.Sp
f4e463df 252[Windows only] The "debug" mode can be toggled by the command
f9e10201
JD
253\fBsmartd sigusr2\fP.
254A new console for debug output is opened when debug mode is enabled.
d008864d 255.\" %ENDIF OS Windows
832b75ed
GG
256.TP
257.B \-D, \-\-showdirectives
258Prints a list (to STDOUT) of all the possible Directives which may
259appear in the configuration file /usr/local/etc/smartd.conf, and then exits.
d2e702cf
GI
260These Directives are described in the \fBsmartd.conf\fP(5) man page.
261They may appear in the configuration file following the device name.
832b75ed
GG
262.TP
263.B \-h, \-\-help, \-\-usage
264Prints usage message to STDOUT and exits.
265.TP
266.B \-i N, \-\-interval=N
267Sets the interval between disk checks to \fIN\fP seconds, where
268\fIN\fP is a decimal integer. The minimum allowed value is ten and
269the maximum is the largest positive integer that can be represented on
f9e10201
JD
270your system (often 2^31\-1). The default is 1800 seconds.
271.Sp
832b75ed
GG
272Note that the superuser can make \fBsmartd\fP check the status of the
273disks at any time by sending it the \fBSIGUSR1\fP signal, for example
274with the command:
f9e10201
JD
275.br
276.B kill \-SIGUSR1 <pid>
277.br
832b75ed
GG
278where \fB<pid>\fP is the process id number of \fBsmartd\fP. One may
279also use:
f9e10201
JD
280.br
281.B killall \-USR1 smartd
282.br
832b75ed 283for the same purpose.
d2e702cf 284.br
d008864d 285.\" %IF OS Windows
832b75ed 286(Windows: See NOTES below.)
d008864d 287.\" %ENDIF OS Windows
832b75ed
GG
288.TP
289.B \-l FACILITY, \-\-logfacility=FACILITY
290Uses syslog facility FACILITY to log the messages from \fBsmartd\fP.
291Here FACILITY is one of \fIlocal0\fP, \fIlocal1\fP, ..., \fIlocal7\fP,
292or \fIdaemon\fP [default]. If this command-line option is not used,
293then by default messages from \fBsmartd\fP are logged to the facility
294\fIdaemon\fP.
f9e10201 295.Sp
832b75ed 296If you would like to have \fBsmartd\fP messages logged somewhere other
f9e10201 297than the default location, include (for example) \*(Aq\-l local3\*(Aq in its
d2e702cf
GI
298start up argument list.
299Tell the syslog daemon to log all messages from facility \fBlocal3\fP
f9e10201
JD
300to (for example) \*(Aq/var/log/smartd.log\*(Aq.
301.Sp
832b75ed 302For more detailed information, please refer to the man pages for
d2e702cf
GI
303the local syslog daemon, typically \fBsyslogd\fP(8), \fBsyslog-ng\fP(8)
304or \fBrsyslogd\fP(8).
d008864d 305.\" %IF OS Cygwin
f9e10201
JD
306.Sp
307Cygwin: If no \fBsyslogd\fP is running, the \*(Aq\-l\*(Aq option has no effect.
d008864d
GI
308In this case, all \fBsyslog\fP messages are written to Windows event log.
309.\" %ENDIF OS Cygwin
310.\" %IF OS Windows
f9e10201 311.Sp
832b75ed 312Windows: Some \fBsyslog\fP functionality is implemented
f9e10201
JD
313internally in \fBsmartd\fP as follows: If no \*(Aq\-l\*(Aq option
314(or \*(Aq\-l daemon\*(Aq) is specified, messages are written to Windows
832b75ed 315event log or to file \fB./smartd.log\fP if event log is not available
f9e10201
JD
316(access denied).
317By specifying other values of FACILITY, log output is redirected as follows:
318\*(Aq\-l local0\*(Aq to file \fB./smartd.log\fP,
319\*(Aq\-l local1\*(Aq to standard output (redirect with \*(Aq>\*(Aq to any file),
320\*(Aq\-l local2\*(Aq to standard error,
321\*(Aq\-l local[3\-7]\*(Aq: to file \fB./smartd[1\-5].log\fP.
d008864d 322.\" %ENDIF OS Windows
a37e7145
GG
323.TP
324.B \-n, \-\-no\-fork
325Do not fork into background; this is useful when executed from modern
a86ec89e 326init methods like initng, minit, supervise or systemd.
d008864d 327.\" %IF OS Cygwin
f9e10201 328.Sp
a37e7145
GG
329On Cygwin, this allows running \fBsmartd\fP as service via cygrunsrv,
330see NOTES below.
d008864d
GI
331.\" %ENDIF OS Cygwin
332.\" %IF OS Windows
f9e10201
JD
333.Sp
334On Windows, this option is not available, use \*(Aq\-\-service\*(Aq instead.
d008864d 335.\" %ENDIF OS Windows
832b75ed
GG
336.TP
337.B \-p NAME, \-\-pidfile=NAME
338Writes pidfile \fINAME\fP containing the \fBsmartd\fP Process ID
339number (PID). To avoid symlink attacks make sure the directory to
340which pidfile is written is only writable for root. Without this
341option, or if the \-\-debug option is given, no PID file is written on
342startup. If \fBsmartd\fP is killed with a maskable signal then the
343pidfile is removed.
344.TP
345.B \-q WHEN, \-\-quit=WHEN
346Specifies when, if ever, \fBsmartd\fP should exit. The valid
347arguments are to this option are:
f9e10201 348.Sp
832b75ed
GG
349.I nodev
350\- Exit if there are no devices to monitor, or if any errors are found
351at startup in the configuration file. This is the default.
f9e10201 352.Sp
832b75ed
GG
353.I errors
354\- Exit if there are no devices to monitor, or if any errors are found
355in the configuration file /usr/local/etc/smartd.conf at startup or whenever it
356is reloaded.
f9e10201 357.Sp
832b75ed
GG
358.I nodevstartup
359\- Exit if there are no devices to monitor at startup. But continue
360to run if no devices are found whenever the configuration file is
361reloaded.
f9e10201 362.Sp
832b75ed
GG
363.I never
364\- Only exit if a fatal error occurs (no remaining system memory,
f9e10201 365invalid command line arguments). In this mode, even if there are no
832b75ed
GG
366devices to monitor, or if the configuration file
367\fB/usr/local/etc/smartd.conf\fP has errors, \fBsmartd\fP will continue to run,
368waiting to load a configuration file listing valid devices.
f9e10201 369.Sp
832b75ed
GG
370.I onecheck
371\- Start \fBsmartd\fP in debug mode, then register devices, then check
f9e10201 372device's SMART status once, and then exit with zero exit status if all
832b75ed 373of these steps worked correctly.
f9e10201
JD
374.Sp
375This last option is intended for \*(Aqdistribution-writers\*(Aq who want to
832b75ed
GG
376create automated scripts to determine whether or not to automatically
377start up \fBsmartd\fP after installing smartmontools. After starting
f9e10201 378\fBsmartd\fP with this command-line option, the distribution's install
832b75ed
GG
379scripts should wait a reasonable length of time (say ten seconds). If
380\fBsmartd\fP has not exited with zero status by that time, the script
381should send \fBsmartd\fP a SIGTERM or SIGKILL and assume that
382\fBsmartd\fP will not operate correctly on the host. Conversely, if
383\fBsmartd\fP exits with zero status, then it is safe to run
f9e10201 384\fBsmartd\fP in normal daemon mode. If \fBsmartd\fP is unable to
832b75ed
GG
385monitor any devices or encounters other problems then it will return
386with non-zero exit status.
f9e10201 387.Sp
832b75ed
GG
388.I showtests
389\- Start \fBsmartd\fP in debug mode, then register devices, then write
390a list of future scheduled self tests to stdout, and then exit with zero
391exit status if all of these steps worked correctly.
392Device's SMART status is not checked.
f9e10201
JD
393.Sp
394This option is intended to test whether the \*(Aq\-s REGEX\*(Aq directives in
395smartd.conf will have the desired effect. The output lists the next test
396schedules, limited to 5 tests per type and device. This is followed by a
832b75ed
GG
397summary of all tests of each device within the next 90 days.
398.TP
399.B \-r TYPE, \-\-report=TYPE
400Intended primarily to help
401.B smartmontools
402developers understand the behavior of
403.B smartmontools
404on non-conforming or poorly-conforming hardware. This option reports
405details of
406\fBsmartd\fP
407transactions with the device. The option can be used multiple times.
408When used just once, it shows a record of the ioctl() transactions
409with the device. When used more than once, the detail of these ioctl()
410transactions are reported in greater detail. The valid arguments to
411this option are:
f9e10201 412.Sp
832b75ed
GG
413.I ioctl
414\- report all ioctl() transactions.
f9e10201 415.Sp
832b75ed
GG
416.I ataioctl
417\- report only ioctl() transactions with ATA devices.
f9e10201 418.Sp
832b75ed
GG
419.I scsiioctl
420\- report only ioctl() transactions with SCSI devices.
f9e10201
JD
421.Sp
422.\" %IF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
a86ec89e 423.I nvmeioctl
f9e10201 424\- [NEW EXPERIMENTAL SMARTD FEATURE]
a86ec89e 425report only ioctl() transactions with NVMe devices.
f9e10201
JD
426.Sp
427.\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
832b75ed
GG
428Any argument may include a positive integer to specify the level of
429detail that should be reported. The argument should be followed by a
430comma then the integer with no spaces. For example, \fIataioctl,2\fP
f9e10201
JD
431The default level is 1, so \*(Aq\-r ataioctl,1\*(Aq and
432\*(Aq\-r ataioctl\*(Aq are equivalent.
2127e193
GI
433.TP
434.B \-s PREFIX, \-\-savestates=PREFIX
ee38a438 435Reads/writes \fBsmartd\fP state information from/to files
f9e10201
JD
436\*(AqPREFIX\*(Aq\*(AqMODEL\-SERIAL.ata.state\*(Aq or
437\*(AqPREFIX\*(Aq\*(AqVENDOR\-MODEL\-SERIAL.scsi.state\*(Aq.
ee38a438
GI
438This preserves SMART attributes, drive min and max temperatures (\-W directive),
439info about last sent warning email
2127e193
GI
440(\-m directive), and the time of next check of the self-test REGEXP
441(\-s directive) across boot cycles.
f9e10201 442.Sp
d008864d 443.\" %IF ENABLE_SAVESTATES
2127e193 444If this option is not specified, state information is maintained in files
f9e10201
JD
445\*(Aq/usr/local/var/lib/smartmontools/smartd.MODEL\-SERIAL.ata.state\*(Aq
446for ATA devices and
447\*(Aq/usr/local/var/lib/smartmontools/smartd.VENDOR\-MODEL\-SERIAL.scsi.state\*(Aq
448for SCSI devices.
2127e193 449To disable state files, specify this option with an empty string
f9e10201 450argument: \*(Aq\-s ""\*(Aq.
d008864d 451.\" %ENDIF ENABLE_SAVESTATES
2127e193
GI
452MODEL and SERIAL are build from drive identify information, invalid
453characters are replaced by underline.
f9e10201
JD
454.Sp
455If the PREFIX has the form \*(Aq/path/dir/\*(Aq (e.g.\&
456\*(Aq/var/lib/smartd/\*(Aq), then files \*(AqMODEL\-SERIAL.ata.state\*(Aq are
457created in directory \*(Aq/path/dir\*(Aq.
458If the PREFIX has the form \*(Aq/path/name\*(Aq (e.g.\&
459\*(Aq/var/lib/misc/smartd\-\*(Aq),
460then files \*(AqnameMODEL\-SERIAL.ata.state\*(Aq are created in directory
461\*(Aq/path/\*(Aq.
2127e193 462The path must be absolute, except if debug mode is enabled.
f9e10201
JD
463.Sp
464The state information files are read on smartd startup. The files are
2127e193
GI
465always (re)written after reading the configuration file, before rereading
466the configuration file (SIGHUP), before smartd shutdown, and after a check
f9e10201 467forced by SIGUSR1. After a normal check cycle, a file is only rewritten if
2127e193 468an important change (which usually results in a SYSLOG output) occurred.
ee38a438
GI
469.TP
470.B \-w PATH, \-\-warnexec=PATH
ee38a438
GI
471Run the executable PATH instead of the default script when smartd
472needs to send warning messages. PATH must point to an executable binary
473file or script.
474The default script is
475.\" %IF NOT OS Windows
476\fB/usr/local/etc/smartd_warning.sh\fP.
477.\" %ENDIF NOT OS Windows
478.\" %IF OS ALL
479(Windows: EXEDIR/smartd_warning.cmd)
480.\" %ENDIF OS ALL
481.\" %IF OS Windows
482.\"! \fBEXEDIR/smartd_warning.cmd\fP.
483.\" %ENDIF OS Windows
d008864d 484.\" %IF OS Windows
832b75ed
GG
485.TP
486.B \-\-service
f4e463df 487[Windows only] Enables \fBsmartd\fP to run as a Windows service.
832b75ed 488The option must be specified in the service command line as the first
f9e10201
JD
489argument.
490It should not be used from console.
832b75ed 491See NOTES below for details.
d008864d 492.\" %ENDIF OS Windows
832b75ed
GG
493.TP
494.B \-V, \-\-version, \-\-license, \-\-copyright
2127e193
GI
495Prints version, copyright, license, home page and SVN revision
496information for your copy of \fBsmartd\fP to STDOUT and then exits.
f9e10201 497.Sp
832b75ed 498.SH EXAMPLES
d2e702cf
GI
499.B smartd
500.br
f9e10201 501Runs the daemon in forked mode. This is the normal way to run
832b75ed 502\fBsmartd\fP.
e9583e0c 503Entries are logged to SYSLOG.
f9e10201
JD
504.Sp
505.B smartd \-d \-i 30
d2e702cf 506.br
832b75ed
GG
507Run in foreground (debug) mode, checking the disk status
508every 30 seconds.
f9e10201
JD
509.Sp
510.B smartd \-q onecheck
d2e702cf 511.br
832b75ed 512Registers devices, and checks the status of the devices exactly
f9e10201
JD
513once.
514The exit status (the shell
832b75ed
GG
515.B $?
516variable) will be zero if all went well, and nonzero if no devices
517were detected or some other problem was encountered.
a86ec89e 518.\" %IF ENABLE_INITSCRIPT
f9e10201 519.Sp
832b75ed
GG
520Note that \fBsmartmontools\fP provides a start-up script in
521\fB/usr/local/etc/rc.d/init.d/smartd\fP which is responsible for starting and
522stopping the daemon via the normal init interface. Using this script,
523you can start \fBsmartd\fP by giving the command:
f9e10201 524.br
832b75ed 525.B /usr/local/etc/rc.d/init.d/smartd start
f9e10201 526.br
832b75ed 527and stop it by using the command:
f9e10201 528.br
832b75ed 529.B /usr/local/etc/rc.d/init.d/smartd stop
a86ec89e 530.\" %ENDIF ENABLE_INITSCRIPT
f9e10201 531.Sp
d008864d 532.SH CONFIGURATION
d2e702cf 533The syntax of the \fBsmartd.conf\fP(5) file is discussed separately.
f9e10201 534.Sp
832b75ed
GG
535.SH NOTES
536\fBsmartd\fP
f9e10201 537will make log entries at loglevel
832b75ed
GG
538.B LOG_INFO
539if the Normalized SMART Attribute values have changed, as reported using the
f9e10201 540.B \*(Aq\-t\*(Aq, \*(Aq\-p\*(Aq,
832b75ed 541or
f9e10201
JD
542.B \*(Aq\-u\*(Aq
543Directives.
544For example:
545.br
546.B \*(AqDevice: /dev/sda, SMART Attribute: 194 Temperature_Celsius changed from 94 to 93\*(Aq
547.br
548Note that in this message, the value given is the \*(AqNormalized\*(Aq not the
549\*(AqRaw\*(Aq Attribute value (the disk temperature in this case is about 22
550Celsius). The
551.B \*(Aq\-R\*(Aq
552and
553.B \*(Aq\-r\*(Aq
832b75ed
GG
554Directives modify this behavior, so that the information is printed
555with the Raw values as well, for example:
f9e10201
JD
556.br
557.B \*(AqDevice: /dev/sda, SMART Attribute: 194 Temperature_Celsius changed from 94 [Raw 22] to 93 [Raw 23]\*(Aq
558.br
832b75ed
GG
559Here the Raw values are the actual disk temperatures in Celsius. The
560way in which the Raw values are printed, and the names under which the
561Attributes are reported, is governed by the various
f9e10201 562.B \*(Aq\-v Num,Description\*(Aq
832b75ed 563Directives described previously.
f9e10201 564.PP
832b75ed
GG
565Please see the
566.B smartctl
567manual page for further explanation of the differences between
568Normalized and Raw Attribute values.
f9e10201 569.PP
832b75ed
GG
570\fBsmartd\fP
571will make log entries at loglevel
572.B LOG_CRIT
573if a SMART Attribute has failed, for example:
f9e10201
JD
574.br
575.B \*(AqDevice: /dev/sdc, Failed SMART Attribute: 5 Reallocated_Sector_Ct\*(Aq
576.br
832b75ed 577 This loglevel is used for reporting enabled by the
f9e10201 578.B \*(Aq\-H\*(Aq, \-f\*(Aq, \*(Aq\-l\ selftest\*(Aq,
832b75ed 579and
f9e10201
JD
580.B \*(Aq\-l\ error\*(Aq
581Directives. Entries reporting failure of SMART Prefailure Attributes
832b75ed
GG
582should not be ignored: they mean that the disk is failing. Use the
583.B smartctl
f9e10201 584utility to investigate.
d008864d 585.\" %IF OS Solaris
f9e10201 586.PP
832b75ed
GG
587Under Solaris with the default \fB/etc/syslog.conf\fP configuration,
588messages below loglevel \fBLOG_NOTICE\fP will \fBnot\fP be recorded.
589Hence all \fBsmartd\fP messages with loglevel \fBLOG_INFO\fP will be
590lost. If you want to use the existing daemon facility to log all
591messages from \fBsmartd\fP, you should change \fB/etc/syslog.conf\fP
592from:
f9e10201 593.Vb 1
832b75ed 594 ...;daemon.notice;... /var/adm/messages
f9e10201 595.Ve
832b75ed 596to read:
f9e10201 597.Vb 1
832b75ed 598 ...;daemon.info;... /var/adm/messages
f9e10201 599.Ve
832b75ed 600Alternatively, you can use a local facility to log messages: please
f9e10201 601see the \fBsmartd\fP \*(Aq\-l\*(Aq command-line option described above.
d008864d
GI
602.\" %ENDIF OS Solaris
603.\" %IF OS Cygwin
f9e10201 604.PP
d008864d 605The Cygwin Version of \fBsmartd\fP can be run as a service via the
a86ec89e
GI
606cygrunsrv tool.
607.\" %IF ENABLE_INITSCRIPT
608The start-up script provides Cygwin-specific commands to install and
609remove the service:
f9e10201 610.br
d008864d 611.B /usr/local/etc/rc.d/init.d/smartd install [options]
f9e10201 612.br
d008864d 613.B /usr/local/etc/rc.d/init.d/smartd remove
f9e10201 614.br
d008864d
GI
615The service can be started and stopped by the start-up script as usual
616(see \fBEXAMPLES\fP above).
a86ec89e 617.\" %ENDIF ENABLE_INITSCRIPT
d008864d
GI
618.\" %ENDIF OS Cygwin
619.\" %IF OS Windows
f9e10201 620.PP
d008864d 621On Windows, the log messages are written to the event log or to a file.
f9e10201
JD
622See documentation of the \*(Aq\-l FACILITY\*(Aq option above for details.
623.PP
832b75ed
GG
624On Windows, the following built-in commands can be used to control
625\fBsmartd\fP, if running as a daemon:
f9e10201
JD
626.PP
627\*(Aq\fBsmartd status\fP\*(Aq \- check status
628.br
629\*(Aq\fBsmartd stop\fP\*(Aq \- stop smartd
630.br
631\*(Aq\fBsmartd reload\fP\*(Aq \- reread config file
632.br
633\*(Aq\fBsmartd restart\fP\*(Aq \- restart smartd
634.br
635\*(Aq\fBsmartd sigusr1\fP\*(Aq \- check disks now
636.br
637\*(Aq\fBsmartd sigusr2\fP\*(Aq \- toggle debug mode
638.PP
832b75ed 639The Windows Version of \fBsmartd\fP has buildin support for services:
f9e10201
JD
640.PP
641\*(Aq\fBsmartd install [options]\fP\*(Aq installs a service
832b75ed 642named "smartd" (display name "SmartD Service") using the command line
f9e10201 643\*(Aq/INSTALLPATH/smartd.exe \-\-service [options]\*(Aq.
ee38a438
GI
644This also installs smartd.exe as a event message file for the Windows
645event viewer.
f9e10201
JD
646.PP
647\*(Aq\fBsmartd remove\fP\*(Aq can later be used to remove the service and
ee38a438 648event message entries from the registry.
f9e10201 649.PP
832b75ed 650Upon startup, the smartd service changes the working directory
f9e10201
JD
651to its own installation path. If smartd.conf and blat.exe are stored
652in this directory, no \*(Aq\-c\*(Aq option and \*(Aq\-M exec\*(Aq directive
653is needed.
654.PP
655The debug mode (\*(Aq\-d\*(Aq, \*(Aq\-q onecheck\*(Aq) does not work if
656smartd is running as service.
657.PP
658The service can be controlled as usual with Windows commands \*(Aqnet\*(Aq
659or \*(Aqsc\*(Aq (\*(Aq\fBnet start smartd\fP\*(Aq,
660\*(Aq\fBnet stop smartd\fP\*(Aq).
661.PP
662Pausing the service (\*(Aq\fBnet pause smartd\fP\*(Aq) sets the interval
663between disk checks (\*(Aq\-i N\*(Aq) to infinite.
664.PP
665Continuing the paused service (\*(Aq\fBnet continue smartd\fP\*(Aq) resets the
666interval and rereads the configuration file immediately (like \fBSIGHUP\fP).
667The \*(AqPARAMCHANGE\*(Aq service control command (\*(Aq\fBsc control smartd
668paramchange\fP\*(Aq) has the same effect regardless of paused state.
669.PP
670Continuing a still running service (\*(Aq\fBnet continue smartd\fP\*(Aq without
671preceding \*(Aq\fBnet pause smartd\fP\*(Aq) does not reread configuration but
832b75ed 672checks disks immediately (like \fBSIGUSR1\fP).
d008864d 673.\" %ENDIF OS Windows
f9e10201 674.Sp
832b75ed 675.SH LOG TIMESTAMP TIMEZONE
832b75ed
GG
676When \fBsmartd\fP makes log entries, these are time-stamped. The time
677stamps are in the computer's local time zone, which is generally set
f9e10201 678using either the environment variable \*(Aq\fBTZ\fP\*(Aq or using a
832b75ed
GG
679time-zone file such as \fB/etc/localtime\fP. You may wish to change
680the timezone while \fBsmartd\fP is running (for example, if you carry
681a laptop to a new time-zone and don't reboot it). Due to a bug in the
d2e702cf 682\fBtzset\fP(3) function of many unix standard C libraries, the
832b75ed
GG
683time-zone stamps of \fBsmartd\fP might not change. For some systems,
684\fBsmartd\fP will work around this problem \fIif\fP the time-zone is
f9e10201
JD
685set using \fB/etc/localtime\fP. The work-around \fIfails\fP if the
686time-zone is set using the \*(Aq\fBTZ\fP\*(Aq variable (or a file that it
832b75ed 687points to).
f9e10201 688.Sp
a86ec89e
GI
689.SH EXIT STATUS
690The exit status (return value) of \fBsmartd\fP can have the following values:
832b75ed
GG
691.TP
692.B 0:
f9e10201
JD
693Daemon startup successful, or \fBsmartd\fP was killed by a SIGTERM
694(or in debug mode, a SIGQUIT).
832b75ed
GG
695.TP
696.B 1:
697Commandline did not parse.
698.TP
699.B 2:
700There was a syntax error in the config file.
701.TP
702.B 3:
703Forking the daemon failed.
704.TP
705.B 4:
f9e10201 706Couldn't create PID file.
832b75ed
GG
707.TP
708.B 5:
f9e10201
JD
709Config file does not exist (only returned in conjunction with the \*(Aq\-c\*(Aq
710option).
832b75ed
GG
711.TP
712.B 6:
713Config file exists, but cannot be read.
714.TP
715.B 8:
716\fBsmartd\fP
717ran out of memory during startup.
718.TP
f4e463df 719.B 10:
f9e10201
JD
720An inconsistency was found in \fBsmartd\fP's internal data
721structures. This should never happen. It must be due to either a
832b75ed 722coding or compiler bug. \fIPlease\fP report such failures to
a86ec89e 723smartmontools developers, see REPORTING BUGS below.
832b75ed
GG
724.TP
725.B 16:
726A device explicitly listed in
727.B /usr/local/etc/smartd.conf
f9e10201 728can't be monitored.
832b75ed
GG
729.TP
730.B 17:
731\fBsmartd\fP
f9e10201 732didn't find any devices to monitor.
832b75ed
GG
733.TP
734.B 254:
735When in daemon mode,
736\fBsmartd\fP
737received a SIGINT or SIGQUIT. (Note that in debug mode, SIGINT has
738the same effect as SIGHUP, and makes \fBsmartd\fP reload its
f9e10201 739configuration file. SIGQUIT has the same effect as SIGTERM and causes
832b75ed
GG
740\fBsmartd\fP to exit with zero exit status.
741.TP
742.B 132 and above
743\fBsmartd\fP
744was killed by a signal that is not explicitly listed above. The exit
745status is then 128 plus the signal number. For example if
746\fBsmartd\fP
747is killed by SIGKILL (signal 9) then the exit status is 137.
f9e10201 748.Sp
d2e702cf
GI
749.\" %IF NOT OS Windows
750.SH FILES
751.TP
752.B /usr/local/sbin/smartd
753full path of this executable.
754.TP
755.B /usr/local/etc/smartd.conf
756configuration file (see \fBsmartd.conf\fP(5) man page).
757.TP
758.B /usr/local/etc/smartd_warning.sh
f9e10201
JD
759script run on warnings (see \*(Aq\-w\*(Aq option above and \*(Aq\-M exec\*(Aq
760directive on \fBsmartd.conf\fP(5) man page).
d2e702cf
GI
761.\" %IF ENABLE_SMARTDPLUGINDIR
762.TP
763.B /usr/local/etc/smartd_warning.d/
f9e10201 764plugin directory for smartd warning script (see \*(Aq\-m\*(Aq directive on
d2e702cf
GI
765\fBsmartd.conf\fP(5) man page).
766.\" %ENDIF ENABLE_SMARTDPLUGINDIR
767.\" %IF ENABLE_DRIVEDB
768.TP
769.B /usr/local/share/smartmontools/drivedb.h
f9e10201 770drive database (see \*(Aq\-B\*(Aq option).
d2e702cf
GI
771.\" %ENDIF ENABLE_DRIVEDB
772.TP
773.B /usr/local/etc/smart_drivedb.h
f9e10201
JD
774optional local drive database (see \*(Aq\-B\*(Aq option).
775.Sp
d2e702cf 776.\" %ENDIF NOT OS Windows
ee38a438 777.SH AUTHORS
a86ec89e 778\fBBruce Allen\fP (project initiator),
d2e702cf 779.br
a86ec89e 780\fBChristian Franke\fP (project manager, Windows port and all sort of things),
d2e702cf 781.br
a86ec89e 782\fBDouglas Gilbert\fP (SCSI subsystem),
d2e702cf 783.br
a86ec89e 784\fBVolker Kuhlmann\fP (moderator of support and database mailing list),
d2e702cf 785.br
a86ec89e 786\fBGabriele Pohl\fP (wiki & development team support),
d2e702cf 787.br
a86ec89e 788\fBAlex Samorukov\fP (FreeBSD port and more, new Trac wiki).
f9e10201 789.PP
a86ec89e
GI
790Many other individuals have made contributions and corrections,
791see AUTHORS, ChangeLog and repository files.
f9e10201 792.PP
a86ec89e
GI
793The first smartmontools code was derived from the smartsuite package,
794written by Michael Cornwell and Andre Hedrick.
f9e10201 795.Sp
a86ec89e
GI
796.SH REPORTING BUGS
797To submit a bug report, create a ticket in smartmontools wiki:
d2e702cf 798.br
f9e10201 799<\fBhttps://www.smartmontools.org/\fP>.
d2e702cf 800.br
a86ec89e 801Alternatively send the info to the smartmontools support mailing list:
d2e702cf 802.br
f9e10201
JD
803<\fBhttps://listi.jpberlin.de/mailman/listinfo/smartmontools-support\fB>.
804.Sp
d2e702cf 805.SH SEE ALSO
a86ec89e
GI
806\fBsmartd.conf\fP(5), \fBsmartctl\fP(8).
807.\" %IF ENABLE_UPDATE_SMART_DRIVEDB
808.br
809\fBupdate-smart-drivedb\fP(8).
810.\" %ENDIF ENABLE_UPDATE_SMART_DRIVEDB
f9e10201 811.Sp
d2e702cf
GI
812.SH REFERENCES
813Please see the following web site for more info:
f9e10201
JD
814<\fBhttps://www.smartmontools.org/\fP>
815.PP
832b75ed
GG
816An introductory article about smartmontools is \fIMonitoring Hard
817Disks with SMART\fP, by Bruce Allen, Linux Journal, January 2004,
f9e10201
JD
818pages 74\(en77.
819See <\fBhttps://www.linuxjournal.com/article/6983\fP>.
820.PP
832b75ed
GG
821If you would like to understand better how SMART works, and what it
822does, a good place to start is with Sections 4.8 and 6.54 of the first
f9e10201 823volume of the \*(AqAT Attachment with Packet Interface-7\*(Aq (ATA/ATAPI-7)
e9583e0c
GI
824specification Revision 4b. This documents the SMART functionality which the
825\fBsmartmontools\fP utilities provide access to.
f9e10201 826.PP
ee38a438
GI
827The functioning of SMART was originally defined by the SFF-8035i
828revision 2 and the SFF-8055i revision 1.4 specifications. These are
e9583e0c 829publications of the Small Form Factors (SFF) Committee.
f9e10201 830.PP
e9583e0c 831Links to these and other documents may be found on the Links page of the
f9e10201
JD
832\fBsmartmontools\fP Wiki at <\fBhttps://www.smartmontools.org/wiki/Links\fP>.
833.Sp
a86ec89e
GI
834.SH PACKAGE VERSION
835CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
836.br
f9e10201 837$Id: smartd.8.in 4576 2017-10-29 16:41:44Z chrfranke $