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
|
.TH ICHECK 8
.CT 1 sa_nonmortals
.SH NAME
icheck, dcheck, ncheck \- file system consistency check
.SH SYNOPSIS
.B /etc/icheck
[
option ... ]
.I filesystem ...
.PP
.B /etc/dcheck
[
option ... ]
.I filesystem ...
.PP
.B /etc/ncheck
[
option ... ]
.I filesystem ...
.SH DESCRIPTION
These programs perform
consistency checks on file systems.
For normal file system maintenance, see
.IR fsck (8).
Common options are
.TP
.B -B
The file system is bitmapped.
If
.I filesystem
is a special file, this option is set automatically from
the minor device number.
.TP
.BI -i " number ...
Report only on specified inode
.I numbers
.RI ( dcheck
and
.I ncheck
only).
.PP
.I Icheck
examines each
.I filesystem,
builds a list of used blocks,
and compares this list against
the free list maintained on the file system.
The normal output of
.I icheck
includes a report of
.IP ""
The total number of files and the numbers of
regular, directory, block special and character special files.
.IP ""
The total number of blocks in use and the numbers of
single-, double-, and triple-indirect blocks and directory blocks.
.IP ""
The number of free blocks.
.IP ""
The number of blocks missing;
.I i.e.\&
not in any file
nor in the free list.
.PP
Other
.I icheck
options are
.TP
.B -s
Ignore the free list and reconstruct a new one
by rewriting the super-block of the file system.
The file system should be dismounted while this is done;
if this is not possible (for example if
the root file system has to be salvaged)
care should be taken that the system is quiescent.
The words in the super-block
which indicate the size of the free list and of the
i-list are believed.
If the super-block has been curdled
these words will have to be patched.
The normal output reports are suppressed.
.TP
.BI -b " number ...
Report each appearance of the selected block
.I numbers
in a file or on the free list.
.TP
.B -d
Report each duplicate block.
.TP
.B -m
Report each missing block.
.TP
.B -e
Print at most one diagnostic per file;
useful for badly curdled file systems.
.PP
.I Dcheck
reads the directories in each
.I filesystem
and compares
the link count in each inode with the number of directory
entries by which it is referenced.
.PP
.I Ncheck
generates a list of pathname vs i-number for each named
.I filesystem.
Other
.I ncheck
options are
.TP
.B -a
Report
.L .
and
.LR .. ,
which are normally ignored.
.TP
.B -s
Report only special files, and files with
set-userid or set-groupid mode;
helpful in finding security breaches.
.SH "SEE ALSO"
.IR filsys (5),
.IR chuck (8),
.IR fsck (8),
.IR clri (8)
.SH DIAGNOSTICS
For duplicate blocks
and bad blocks (which lie outside the file system)
.I icheck
announces the difficulty, the i-number, and the kind of block involved.
If a read error is encountered,
the block number of the bad block is printed and
.I icheck
considers it to contain 0.
`Bad freeblock' means that
a block number outside the available space was encountered in the free list.
`Dups in free'
means that
blocks were found in the free list which
duplicate blocks either in some file or in the
earlier part of the free list.
.PP
When a file turns up for which the link-count and the number
of directory entries disagree,
.I dcheck
reports the relevant facts.
Allocated files which have 0 link-count and no entries are also
listed.
The only dangerous situation
occurs when there are more entries than links;
if entries are removed,
so the link-count drops to 0,
the remaining entries point to thin air.
They should be removed.
When there are more links than entries, or there is
an allocated file with neither links nor entries,
some disk space may be lost but the situation will not degenerate.
.PP
When the filesystem structure is improper,
.I ncheck
prints
.L ??
to denote the `parent' of
a parentless file.
A pathname beginning with
.L ...
denotes a loop.
.SH BUGS
Extraneous diagnostics
may be produced if these commands are applied to
active file systems.
.br
They believe even preposterous super-blocks and
consequently can get core images.
.br
.I Ncheck's
report is in no useful
order, and probably should be sorted.
.I Ncheck
fails to report the root inode.
|