summaryrefslogtreecommitdiffstats
path: root/usr.sbin/diskcheckd/diskcheckd.8
blob: 83d78785d3ad7f742a4628f9ebe705e5506fce9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
.\" Copyright (c) 2000, 2001 Ben Smithurst <ben@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 4, 2001
.Dt DISKCHECKD 8
.Os
.Sh NAME
.Nm diskcheckd
.Nd daemon to check for disk read errors
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl f Ar conf_file
.Op Fl o Ar save_file
.Sh DESCRIPTION
.Nm
is a daemon which runs in the background,
reading entire disks to find any read errors on those disks.
The disks which should be scanned,
and the rates at which they should be scanned,
must be specified in the configuration file,
which is
.Pa /etc/diskcheckd.conf
by default.
.Pp
Any blank lines or lines starting with a
.Ql #
character in this file are ignored.
Each non-comment line of this file must be in one of two formats.
The first format is
.Ql !xx ,
and specifies that device names matching
.Pa /dev/xx*
should not be included in expansion of wildcards (see below).
The second format consists of four white space separated
fields,
which are the full pathname of the disk device,
the size of that disk,
the frequency in days at which to check that disk,
and the rate in kilobytes per second at which to check this disk.
Naturally,
it would be contradictory to specify both the frequency and the rate,
so only one of these should be specified.
Additionally,
the size of the disk should not be specified if the rate is specified,
as this information is unnecessary.
.Pp
If the disk is specified as
.Dq * ,
then
.Nm
will apply the given settings to all disks in the system,
obtained using the
.Va kern.disks
sysctl variable.
If the size is specified as
.Dq *
(recommended),
then the size of the disk will be automatically determined from the
disklabel,
if possible.
Fields which are not specified should contain a single
.Dq *
character.
.Pp
Note that
.Nm
always reads data from the disk in 64KB blocks,
so the rate your specify may not be the exact rate at which the disk is
actually checked.
Similarly,
if you specify the third field (days for complete scan) it is unlikely
that a complete scan will actually take exactly this many days.
.Pp
To run
.Nm
automatically at boot time,
the
.Va diskcheckd_enable
variable in
.Xr rc.conf 5
should be set to
.Dq YES .
.Pp
When
.Nm
receives a
.Dv SIGTERM
or
.Dv SIGINT
signal,
it saves its current state information to a file,
so that after a reboot
.Nm
can resume reading from where it left off,
rather than starting from the beginning of the disk again.
The information saved to this file consists of the device filename and the
current offset into that device.
.Pp
.Nm
can be instructed to reload the configuration file by sending it a
.Dv SIGHUP
signal.
.Pp
.Nm
accepts the following command line options:
.Bl -tag -width Fl
.It Fl d
If this flag is specified,
.Nm
will not fork into the background and detach from its controlling terminal
to become a daemon.
This flag is primarily used for debugging.
.It Fl f
Specify the configuration file to use,
instead of the default
.Pa /etc/diskcheckd.conf .
.It Fl o
Specify the file to save disk offsets to,
instead of the default
.Pa /var/db/diskcheckd.offsets .
.El
.Sh FILES
.Bl -tag -width /var/db/diskcheckd.offsets -compact
.It Pa /etc/diskcheckd.conf
Default configuration file.
.It Pa /var/db/diskcheckd.offsets
Default location of saved offsets.
.El
.Sh EXAMPLES
To check all of
.Pa /dev/ad0
for errors once every two weeks,
use this entry in
.Pa diskcheckd.conf :
.Bd -literal -offset indent
/dev/ad0	*	14	*
.Ed
.Pp
To check the first SCSI disk for errors at approximately 64KB/s,
use the following entry:
.Bd -literal -offset indent
/dev/da0	*	*	64
.Ed
.Pp
To check all disks once every four weeks:
.Bd -literal -offset indent
*	*	28	*
.Ed
.Sh DIAGNOSTICS
If any errors occur,
they will be written to
.Xr syslogd 8 .
.Sh HISTORY
.Nm
first appeared in
.Fx 5.0 .
.Sh AUTHORS
.An -nosplit
.Nm
and this manual page were written by
.An Ben Smithurst Aq ben@FreeBSD.org ,
with input from
.An Poul-Henning Kamp Aq phk@FreeBSD.org .
.Sh BUGS
.Nm
assumes all disks have 512 byte sectors.
OpenPOWER on IntegriCloud