diskcheckd
—
daemon to check for disk read errors
diskcheckd |
[-d ] [-f
conf_file] [-o
save_file] |
diskcheckd
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
/usr/local/etc/diskcheckd.conf by default.
Any blank lines or lines starting with a
‘#
’ character in this file are
ignored. Each non-comment line of this file must be in one of two formats.
The first format is ‘!xx
’, and
specifies that device names matching /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.
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.
If the disk is specified as “*”, then
diskcheckd
will apply the given settings to all
disks in the system, obtained using the kern.disks
sysctl variable. If the size is specified as “*”
(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 “*” character.
Note that diskcheckd
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.
To run diskcheckd
automatically at boot
time, the diskcheckd_enable variable in
rc.conf(5)
should be set to “YES”.
When diskcheckd
receives a
SIGTERM
or SIGINT
signal, it
saves its current state information to a file, so that after a reboot
diskcheckd
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.
diskcheckd
can be instructed to reload the
configuration file by sending it a SIGHUP
signal.
diskcheckd
accepts the following command
line options:
-d
- If this flag is specified,
diskcheckd
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.
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.
-f
- Specify the configuration file to use, instead of the default
/usr/local/etc/diskcheckd.conf.
-o
- Specify the file to save disk offsets to, instead of the default
/var/db/diskcheckd.offsets.
After every 5 minutes or so of sleep time between reads (not
including time spent waiting for the reads themselves to complete),
diskcheckd
will update its command parameter space
to show its progress in scanning each disk. This report can be viewed using
ps(1).
- /usr/local/etc/diskcheckd.conf
- Default configuration file.
- /var/db/diskcheckd.offsets
- Default location of saved offsets.
To check all of /dev/ad0 for errors once
every two weeks, use this entry in
diskcheckd.conf:
To check the first SCSI disk for errors at approximately 64KB/s,
use the following entry:
To check all disks once every four weeks:
If any errors occur, they will be written to
syslogd(8).
diskcheckd
first appeared in
FreeBSD 5.0.
diskcheckd
and this manual page were
written by Ben Smithurst
⟨ben@FreeBSD.org⟩, with input from
Poul-Henning Kamp ⟨phk@FreeBSD.org⟩.
The geom-aware version of the sector->partition translation code was
added by Perry Hutchison
⟨perryh@pluto.rain.com⟩, based on a mechanism suggested by
Warner Losh ⟨imp@bsdimp.com⟩.
diskcheckd
Too much of the code assumes
all disks have 512 byte sectors.
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
FreeBSD 11.0 ), does not understand either GPT
partitions or dedicated BSD disks (having the BSD disklabel in place of an
MBR).