.TH dcheck "" "" Command
.PC "Check directory consistency"
\fBdcheck [\-s] [\-i \fIinumber...\^\fB] \fIfilesystem\fR ...
.PP
.HS
.SH Options:
.IC \fB\-s\fR
Cause \fBdcheck\fR to correct link counts automatically
.IC \fB\-i\fR
Print information about each given i-number
.HE
.B dcheck
checks the consistency of each
.IR filesystem .
It scans all the directories in each
.I filesystem
and counts all i-nodes referenced.
It then compares its counts against the link counts
maintained in the i-nodes.
.B dcheck
notes any discrepancies,
and notes allocated i-nodes with a link count of zero.
.PP
The
.B \-i
argument tells
.B dcheck
to compare each
.I inumber
in the list against those in each directory.
It reports matches by printing
the i-number, the i-number of the parent directory,
and the name of the entry.
The
.B \-s
argument tells
.B dcheck
to correct the link count of errant i-nodes to the entry count.
.PP
Because
.B dcheck
uses two passes to check a
.IR filesystem ,
the file system should be unmounted.
If
.B \-s
is used on the root file system,
the system should be rebooted immediately
(without performing a
.BR sync ).
The raw device should be used.
.SH "See Also"
.Xr "check," check
.Xr "commands," commands
.Xr "icheck," icheck
.Xr "ncheck," ncheck
.Xr "sync," sync
.Xr "umount" umount
.SH Diagnostics
If the link count is zero and there are entries,
the file system must be mounted and all entries removed immediately.
If the link count is nonzero and the entry count is
.I larger,
the
.B \-s
option must be used to make the counts agree.
In all other cases there may be wasted disk space
but there is no danger of losing file data.
.SH Notes
In earlier releases of \*(CO,
.B dcheck
acted upon a default file system if none was specified.
.PP
This command has largely been replaced by
.BR fsck .
