Mercurial > hg > Members > kono > nitros9-code
changeset 135:af482a526063
Split up the commands into individual files.
author | roug |
---|---|
date | Sun, 07 Jul 2002 08:58:56 +0000 |
parents | 52af9581ef1e |
children | 94476830df51 |
files | docs/nitros9guide/dcheck.refentry |
diffstat | 1 files changed, 222 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/nitros9guide/dcheck.refentry Sun Jul 07 08:58:56 2002 +0000 @@ -0,0 +1,222 @@ +<refentry id="dcheck"> +<refnamediv> +<refname>DCHECK</refname> +<refpurpose>Check Disk File Structure</refpurpose> +</refnamediv> + +<refsynopsisdiv> +<cmdsynopsis> +<command>DCHECK</command> +<arg choice="opt"> + <option>-opts</option> +</arg> +<arg choice="plain"> + &replstart;devnam&replend; +</arg> +</cmdsynopsis> +</refsynopsisdiv> + +<refsect1><title>Description</title> +<para> +It is possible for sectors on a disk to be marked as being allocated +but in fact are not actually associated with a file or the disk's +free space. This can happen if a disk is removed from a drive while +files are still open, or if a directory which still contains files +is deleted (see 3.5). DCHECK is a diagnostic that can be used to +detect this condition, as well as the general integrity of the directory/file linkages. +</para> +<para> +DCHECK is given as a parameter the name of the disk device to be +checked. After verifying and printing some vital file structure +parameters, DCHECK follows pointers down the disk's file system tree +to all directories and files on the disk. As it does so, it +verifies the integrity of the file descriptor sectors, reports any +discrepancies in the directory/file linkages, and builds a sector +allocation map from the segment list associated with each file. If +any file descriptor sectors (FDs) describe a segment with a cluster +not within the file structure of the disk, a message is reported +like: +</para> +<screen> +*** Bad FD segment ($xxxxxx-$yyyyyy) for file: &replstart;pathlist&replend; +</screen> +<para> +This indicates that a segment starting at sector xxxxxx and ending +at sector yyyyyy cannot really be on this disk. Because there is a +good chance the entire FD is bad if any of it's segment descriptors +are bad, the allocation map is <emphasis>not</emphasis> updated for corrupt FDs. +</para> +<para> +While building the allocation map, DCHECK also makes sure that each +disk cluster appears only once and only once in the file structure. +If this condition is detected, DCHECK will display a message like: +</para> +<screen> +Cluster $xxxxxx was previously allocated +</screen> +<para> +This message indicates that cluster xxxxxx has been found at least +once before in the file structure. The message may be printed more +than once if a cluster appears in a segment in more than one file. +</para> +<para> +The newly created allocation map is then compared to the allocation +map stored on the disk, and any differences are reported in messages +like: +</para> +<screen> +Cluster $xxxxxx in allocation map but not in file structure +Cluster $xxxxxx in file structure but not in allocation map +</screen> +<para> +The first message indicates sector number xxxxxx (hexadecimal) was +found not to be part of the file system, but was marked as allocated +in the disk's allocation map. In addition to the causes mentioned +in the first paragraph, some sectors may have been excluded from the +allocation map by the FORMAT program because they were defective or +they may be the last few sectors of the disk, the sum of which was +two small to comprise a cluster. +</para> +<para> +The second message indicates that the cluster starting at sector +xxxxxx is part of the file structure but is <emphasis>not</emphasis> +marked as allocated +in the disk's allocation map. It is possible that this cluster may +be allocated to another file later, overwriting the contents of the +cluster with data from the newly allocated file. Any clusters that +have been reported as "previously allocated" by DCHECK as described +above surely have this problem. +</para> +<para> +Available DCHECK options are: +</para> + +<informaltable frame="none"> +<tgroup cols="2"> +<colspec colwidth="1.3in"> +<colspec colwidth="3in"> +<tbody> +<row> +<entry>-w=&replstart;path&replend;</entry> +<entry>pathlist to directory for work files</entry> +</row> +<row> +<entry>-p</entry> +<entry>print pathlists for questionable clusters</entry> +</row> +<row> +<entry>-m</entry> +<entry>save allocation map work files</entry> +</row> +<row> +<entry>-b</entry> +<entry>suppress listing of unused clusters</entry> +</row> +<row> +<entry>-s</entry> +<entry>display count of files and directories only</entry> +</row> +<row> +<entry>-o</entry> +<entry>print DCHECK's valid options</entry> +</row> +</tbody> +</tgroup> +</informaltable> + +<para> +The "-s" option causes DCHECK to display a count of files and +directories only; only FDs are checked for validity. The "-b" option +suppresses listing of clusters allocated but not in file structure. +The "-p" option causes DCHECK to make a second pass through the file +structure printing the pathlists for any clusters that DCHECK finds +as "already allocated" or "in file structure but not in allocation +map". The "-w=" option tells DCHECK where to locate it's allocation +map work file(s). The pathlist specified must be a FULL pathlist to +a <emphasis>directory</emphasis>. The directory "/D0" is +used is used if "-w" is not +specified. It is recommended that this pathlist NOT be located on +the disk being DCHECKed if the disk's file structure integrity is in +doubt. +</para> +<para> +DCHECK builds its disk allocation map in a file called +&replstart;pathlist&replend;/DCHECKppO, where &replstart;pathlist&replend; +is as specified by the +"-w=" option and pp is the process number in hexadecimal. Each bit +in this bitmap file corresponds to a cluster of sectors on the disk. +If the "-p" option appears on the command line, DCHECK creates a +second bitmap file (&replstart;pathlist&replend;/DCHECKpp1) that has a bit set for +each cluster DCHECK finds as "previously allocated" or "in file +structure but not in allocation map" while building the allocation +map. DCHECK them makes another pass through the directory structure +to determine the pathlists for these questionable clusters. These +bitmap work files may be saved by specifying the "-m" option on the +command line. +</para> +</refsect1> +<refsect1><title>Restrictions</title> +<para> +For best results, DCHECK should have exclusive access to the disk +being checked. Otherwise DCHECK may be fooled if the disk allocation map +changes while it is building its bitmap file from the +changing file structure. DCHECK cannot process disks with a directory +depth greater than 39 levels. +</para> +<para> +For more information see: 3.10, 3.5, FORMAT, + 6.1 of OS-9 Systems Programmer's Manual +</para> +</refsect1> +<refsect1><title>Examples</title> +<screen> +OS9: dcheck /d2 (workfile is on /D0) + +Volume - 'My system disk' on device /d2 +$009A bytes in allocation map +1 sector per cluster +$0004D0 total sectors on media +Sector $000002 is start of root directory FD +$0010 sectors used for id, allocation map and root directory +Building allocation map work file... +Checking allocation map file... + + +'My system disk' file structure is intact +1 directory +2 files + +OS9: dcheck -mpw=/d2 /d0 +Volume - 'System disk' on device /d0 +$0046 bytes in allocation map +1 sector per cluster +$00022A total sectors on media +Sector $000002 is start of root directory FD +$0010 sectors used for id, allocation map and root directory +Building allocation map work file... +Cluster $00040 was previously allocated +*** Bad FD segment ($111111-$23A6F0) for file: /d0/test/junky.file +Checking allocation map file... +Cluster $000038 in file structure but not in allocation map +Cluster $00003B in file structure but not in allocation map +Cluster $0001B9 in allocation map but not in file structure +Cluster $0001BB in allocation map but not in file structure + +Pathlists for questionable clusters: +Cluster $000038 in path: /d0/OS9boot +Cluster $00003B in path: /d0/OS9boot +Cluster $000040 in path: /d0/OS9boot +Cluster $000040 in path: /d0/test/double.file + +1 previously allocated clusters found +2 clusters in file structure but not in allocation map +2 clusters in allocation map but not in file structure +1 bad file descriptor sector + +'System disk' file structure is not intact +5 directories +25 files +</screen> +</refsect1> +</refentry> +