.\" Copyright (c) 2000, 2001 Ben Smithurst .\" 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: head/sysutils/diskcheckd/files/diskcheckd.8 380226 2015-03-01 20:08:57Z pi $ .\" .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 /usr/local/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 this disk, the frequency in days at which to check this disk, and the rate in kilobytes per second at which to check this disk. .Pp Either the frequency or the rate should be specified, not both, since a specified frequency will be internally converted to whatever rate will result in the disk being scanned at (approximately) that frequency. The size of the disk should not be specified if the rate is specified, since the size is used only to convert a specified frequency into a rate. .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 you 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, and it will duplicate its system log messages on its standard error output. .Pp This flag is primarily used for debugging, and may be specified more than once. Additional instances will result in additional debugging messages on standard error; these added messages will not be written to the system log. .It Fl f Specify the configuration file to use, instead of the default .Pa /usr/local/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 PROGRESS REPORTING After every 5 minutes or so of sleep time between reads (not including time spent waiting for the reads themselves to complete), .Nm will update its command parameter space to show its progress in scanning each disk. This report can be viewed using .Xr ps 1 . .Sh FILES .Bl -tag -width /var/db/diskcheckd.offsets -compact .It Pa /usr/local/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 . The geom-aware version of the sector->partition translation code was added by .An Perry Hutchison Aq perryh@pluto.rain.com , based on a mechanism suggested by .An Warner Losh Aq imp@bsdimp.com . .Sh BUGS .Nm Too much of the code assumes all disks have 512 byte sectors. .Pp There are two versions of the code that attempts to identify and report which slice and/or partition contain a detected error. The older version, used when the DIOCGDINFO ioctl is available (i.e. prior to .Fx 11.0 ), does not understand either GPT partitions or dedicated BSD disks (having the BSD disklabel in place of an MBR).