135
|
1 <refentry id="dcheck">
|
|
2 <refnamediv>
|
|
3 <refname>DCHECK</refname>
|
|
4 <refpurpose>Check Disk File Structure</refpurpose>
|
|
5 </refnamediv>
|
|
6
|
|
7 <refsynopsisdiv>
|
|
8 <cmdsynopsis>
|
|
9 <command>DCHECK</command>
|
|
10 <arg choice="opt">
|
|
11 <option>-opts</option>
|
|
12 </arg>
|
|
13 <arg choice="plain">
|
|
14 &replstart;devnam&replend;
|
|
15 </arg>
|
|
16 </cmdsynopsis>
|
|
17 </refsynopsisdiv>
|
|
18
|
|
19 <refsect1><title>Description</title>
|
|
20 <para>
|
|
21 It is possible for sectors on a disk to be marked as being allocated
|
|
22 but in fact are not actually associated with a file or the disk's
|
|
23 free space. This can happen if a disk is removed from a drive while
|
|
24 files are still open, or if a directory which still contains files
|
|
25 is deleted (see 3.5). DCHECK is a diagnostic that can be used to
|
|
26 detect this condition, as well as the general integrity of the directory/file linkages.
|
|
27 </para>
|
|
28 <para>
|
|
29 DCHECK is given as a parameter the name of the disk device to be
|
|
30 checked. After verifying and printing some vital file structure
|
|
31 parameters, DCHECK follows pointers down the disk's file system tree
|
|
32 to all directories and files on the disk. As it does so, it
|
|
33 verifies the integrity of the file descriptor sectors, reports any
|
|
34 discrepancies in the directory/file linkages, and builds a sector
|
|
35 allocation map from the segment list associated with each file. If
|
|
36 any file descriptor sectors (FDs) describe a segment with a cluster
|
|
37 not within the file structure of the disk, a message is reported
|
|
38 like:
|
|
39 </para>
|
|
40 <screen>
|
|
41 *** Bad FD segment ($xxxxxx-$yyyyyy) for file: &replstart;pathlist&replend;
|
|
42 </screen>
|
|
43 <para>
|
|
44 This indicates that a segment starting at sector xxxxxx and ending
|
|
45 at sector yyyyyy cannot really be on this disk. Because there is a
|
|
46 good chance the entire FD is bad if any of it's segment descriptors
|
|
47 are bad, the allocation map is <emphasis>not</emphasis> updated for corrupt FDs.
|
|
48 </para>
|
|
49 <para>
|
|
50 While building the allocation map, DCHECK also makes sure that each
|
|
51 disk cluster appears only once and only once in the file structure.
|
|
52 If this condition is detected, DCHECK will display a message like:
|
|
53 </para>
|
|
54 <screen>
|
|
55 Cluster $xxxxxx was previously allocated
|
|
56 </screen>
|
|
57 <para>
|
|
58 This message indicates that cluster xxxxxx has been found at least
|
|
59 once before in the file structure. The message may be printed more
|
|
60 than once if a cluster appears in a segment in more than one file.
|
|
61 </para>
|
|
62 <para>
|
|
63 The newly created allocation map is then compared to the allocation
|
|
64 map stored on the disk, and any differences are reported in messages
|
|
65 like:
|
|
66 </para>
|
|
67 <screen>
|
|
68 Cluster $xxxxxx in allocation map but not in file structure
|
|
69 Cluster $xxxxxx in file structure but not in allocation map
|
|
70 </screen>
|
|
71 <para>
|
|
72 The first message indicates sector number xxxxxx (hexadecimal) was
|
|
73 found not to be part of the file system, but was marked as allocated
|
|
74 in the disk's allocation map. In addition to the causes mentioned
|
|
75 in the first paragraph, some sectors may have been excluded from the
|
|
76 allocation map by the FORMAT program because they were defective or
|
|
77 they may be the last few sectors of the disk, the sum of which was
|
|
78 two small to comprise a cluster.
|
|
79 </para>
|
|
80 <para>
|
|
81 The second message indicates that the cluster starting at sector
|
|
82 xxxxxx is part of the file structure but is <emphasis>not</emphasis>
|
|
83 marked as allocated
|
|
84 in the disk's allocation map. It is possible that this cluster may
|
|
85 be allocated to another file later, overwriting the contents of the
|
|
86 cluster with data from the newly allocated file. Any clusters that
|
|
87 have been reported as "previously allocated" by DCHECK as described
|
|
88 above surely have this problem.
|
|
89 </para>
|
|
90 <para>
|
|
91 Available DCHECK options are:
|
|
92 </para>
|
|
93
|
|
94 <informaltable frame="none">
|
|
95 <tgroup cols="2">
|
|
96 <colspec colwidth="1.3in">
|
|
97 <colspec colwidth="3in">
|
|
98 <tbody>
|
|
99 <row>
|
|
100 <entry>-w=&replstart;path&replend;</entry>
|
|
101 <entry>pathlist to directory for work files</entry>
|
|
102 </row>
|
|
103 <row>
|
|
104 <entry>-p</entry>
|
|
105 <entry>print pathlists for questionable clusters</entry>
|
|
106 </row>
|
|
107 <row>
|
|
108 <entry>-m</entry>
|
|
109 <entry>save allocation map work files</entry>
|
|
110 </row>
|
|
111 <row>
|
|
112 <entry>-b</entry>
|
|
113 <entry>suppress listing of unused clusters</entry>
|
|
114 </row>
|
|
115 <row>
|
|
116 <entry>-s</entry>
|
|
117 <entry>display count of files and directories only</entry>
|
|
118 </row>
|
|
119 <row>
|
|
120 <entry>-o</entry>
|
|
121 <entry>print DCHECK's valid options</entry>
|
|
122 </row>
|
|
123 </tbody>
|
|
124 </tgroup>
|
|
125 </informaltable>
|
|
126
|
|
127 <para>
|
|
128 The "-s" option causes DCHECK to display a count of files and
|
|
129 directories only; only FDs are checked for validity. The "-b" option
|
|
130 suppresses listing of clusters allocated but not in file structure.
|
|
131 The "-p" option causes DCHECK to make a second pass through the file
|
|
132 structure printing the pathlists for any clusters that DCHECK finds
|
|
133 as "already allocated" or "in file structure but not in allocation
|
|
134 map". The "-w=" option tells DCHECK where to locate it's allocation
|
|
135 map work file(s). The pathlist specified must be a FULL pathlist to
|
|
136 a <emphasis>directory</emphasis>. The directory "/D0" is
|
|
137 used is used if "-w" is not
|
|
138 specified. It is recommended that this pathlist NOT be located on
|
|
139 the disk being DCHECKed if the disk's file structure integrity is in
|
|
140 doubt.
|
|
141 </para>
|
|
142 <para>
|
|
143 DCHECK builds its disk allocation map in a file called
|
|
144 &replstart;pathlist&replend;/DCHECKppO, where &replstart;pathlist&replend;
|
|
145 is as specified by the
|
|
146 "-w=" option and pp is the process number in hexadecimal. Each bit
|
|
147 in this bitmap file corresponds to a cluster of sectors on the disk.
|
|
148 If the "-p" option appears on the command line, DCHECK creates a
|
|
149 second bitmap file (&replstart;pathlist&replend;/DCHECKpp1) that has a bit set for
|
|
150 each cluster DCHECK finds as "previously allocated" or "in file
|
|
151 structure but not in allocation map" while building the allocation
|
|
152 map. DCHECK them makes another pass through the directory structure
|
|
153 to determine the pathlists for these questionable clusters. These
|
|
154 bitmap work files may be saved by specifying the "-m" option on the
|
|
155 command line.
|
|
156 </para>
|
|
157 </refsect1>
|
|
158 <refsect1><title>Restrictions</title>
|
|
159 <para>
|
|
160 For best results, DCHECK should have exclusive access to the disk
|
|
161 being checked. Otherwise DCHECK may be fooled if the disk allocation map
|
|
162 changes while it is building its bitmap file from the
|
|
163 changing file structure. DCHECK cannot process disks with a directory
|
|
164 depth greater than 39 levels.
|
|
165 </para>
|
|
166 <para>
|
|
167 For more information see: 3.10, 3.5, FORMAT,
|
|
168 6.1 of OS-9 Systems Programmer's Manual
|
|
169 </para>
|
|
170 </refsect1>
|
|
171 <refsect1><title>Examples</title>
|
|
172 <screen>
|
|
173 OS9: dcheck /d2 (workfile is on /D0)
|
|
174
|
|
175 Volume - 'My system disk' on device /d2
|
|
176 $009A bytes in allocation map
|
|
177 1 sector per cluster
|
|
178 $0004D0 total sectors on media
|
|
179 Sector $000002 is start of root directory FD
|
|
180 $0010 sectors used for id, allocation map and root directory
|
|
181 Building allocation map work file...
|
|
182 Checking allocation map file...
|
|
183
|
|
184
|
|
185 'My system disk' file structure is intact
|
|
186 1 directory
|
|
187 2 files
|
|
188
|
|
189 OS9: dcheck -mpw=/d2 /d0
|
|
190 Volume - 'System disk' on device /d0
|
|
191 $0046 bytes in allocation map
|
|
192 1 sector per cluster
|
|
193 $00022A total sectors on media
|
|
194 Sector $000002 is start of root directory FD
|
|
195 $0010 sectors used for id, allocation map and root directory
|
|
196 Building allocation map work file...
|
|
197 Cluster $00040 was previously allocated
|
|
198 *** Bad FD segment ($111111-$23A6F0) for file: /d0/test/junky.file
|
|
199 Checking allocation map file...
|
|
200 Cluster $000038 in file structure but not in allocation map
|
|
201 Cluster $00003B in file structure but not in allocation map
|
|
202 Cluster $0001B9 in allocation map but not in file structure
|
|
203 Cluster $0001BB in allocation map but not in file structure
|
|
204
|
|
205 Pathlists for questionable clusters:
|
|
206 Cluster $000038 in path: /d0/OS9boot
|
|
207 Cluster $00003B in path: /d0/OS9boot
|
|
208 Cluster $000040 in path: /d0/OS9boot
|
|
209 Cluster $000040 in path: /d0/test/double.file
|
|
210
|
|
211 1 previously allocated clusters found
|
|
212 2 clusters in file structure but not in allocation map
|
|
213 2 clusters in allocation map but not in file structure
|
|
214 1 bad file descriptor sector
|
|
215
|
|
216 'System disk' file structure is not intact
|
|
217 5 directories
|
|
218 25 files
|
|
219 </screen>
|
|
220 </refsect1>
|
|
221 </refentry>
|
|
222
|