|
|
1.1 ! root 1: .th CHECK VIII 8/31/73 ! 2: .sh NAME ! 3: check \*- file system consistency check ! 4: .sh SYNOPSIS ! 5: .bd check ! 6: [ ! 7: .bd \*-lsib ! 8: [ numbers ] ! 9: ] ! 10: [ filesystem ] ! 11: .sh DESCRIPTION ! 12: .it Check ! 13: examines a file system, ! 14: builds a bit map of used blocks, ! 15: and compares this bit map against ! 16: the free list maintained on the file system. ! 17: It also reads directories and compares ! 18: the link-count in each i-node with the number of directory ! 19: entries by which it is referenced. ! 20: If the file system is not specified, ! 21: a check of a ! 22: default file system ! 23: is performed. ! 24: The normal output of ! 25: .it check ! 26: includes a report of ! 27: .s3 ! 28: .lp +4 0 ! 29: The number of blocks missing; i.e. not in any file ! 30: nor in the free list, ! 31: .lp +4 0 ! 32: The number of special files, ! 33: .lp +4 0 ! 34: The total number of files, ! 35: .lp +4 0 ! 36: The number of large files, ! 37: .lp +4 0 ! 38: The number of directories, ! 39: .lp +4 0 ! 40: The number of indirect blocks, ! 41: .lp +4 0 ! 42: The number of blocks used in files, ! 43: .lp +4 0 ! 44: The highest-numbered block appearing in a file, ! 45: .lp +4 0 ! 46: The number of free blocks. ! 47: .s3 ! 48: .i0 ! 49: The ! 50: .bd \*-l ! 51: flag causes ! 52: .it check ! 53: to produce as part of its output report a list of the ! 54: all the path names of files on the file system. ! 55: The list is in i-number order; the first ! 56: name for each file gives the i-number while subsequent ! 57: names (i.e. links) have the i-number suppressed. ! 58: The entries ``\fB.\fR'' and ``\fB..\fR'' ! 59: for directories are also suppressed. ! 60: .s3 ! 61: The ! 62: .bd \*-s ! 63: flag causes ! 64: .it check ! 65: to ignore the actual free list and reconstruct a new one ! 66: by rewriting the super-block of the file system. ! 67: The file system should be dismounted while this is done; ! 68: if this is not possible (for example if ! 69: the root file system has to be salvaged) ! 70: care should be taken that the system is quiescent and that ! 71: it is rebooted immediately afterwards so that the old, bad in-core ! 72: copy of the super-block will not continue to be used. ! 73: Notice also that ! 74: the words in the super-block ! 75: which indicate the size of the free list and of the ! 76: i-list are believed. ! 77: If the super-block has been curdled ! 78: these words will have to be patched. ! 79: The ! 80: .bd \*-s ! 81: flag ! 82: causes the normal output reports to be suppressed. ! 83: .s3 ! 84: The occurrence ! 85: of ! 86: .bd i ! 87: .it n ! 88: times in a flag argument ! 89: .bd \*-ii...i ! 90: causes ! 91: .it check ! 92: to store away the next ! 93: .it n ! 94: arguments which are taken to be i-numbers. ! 95: When any of these i-numbers is encountered in a directory ! 96: a diagnostic is produced, as described below, which indicates among ! 97: other things the entry name. ! 98: .s3 ! 99: Likewise, ! 100: .it n ! 101: appearances of ! 102: .bd b ! 103: in a flag like ! 104: .bd \*-bb...b ! 105: cause the next ! 106: .it n ! 107: arguments to be taken as block numbers ! 108: which are remembered; ! 109: whenever any of the named blocks turns up in a file, ! 110: a diagnostic is produced. ! 111: .sh FILES ! 112: Currently, /dev/rp0 is the default file system. ! 113: .sh "SEE ALSO" ! 114: fs (V) ! 115: .sh DIAGNOSTICS ! 116: There are some self-evident diagnostics like ! 117: ``can't open ...'', ``can't write ....'' ! 118: If a read error is encountered, ! 119: the block number of the bad block is printed and ! 120: .it check ! 121: exits. ! 122: ``Bad freeblock'' means that ! 123: a block number outside the available space was encountered in the free list. ! 124: ``\fIn\fR dups in free'' ! 125: means that \fIn\fR blocks were found in the free list which ! 126: duplicate blocks either in some file or in the earlier part of the free list. ! 127: .s3 ! 128: An important class of diagnostics is produced by a routine which ! 129: is called for each block which is encountered in an i-node ! 130: corresponding to an ordinary file or directory. ! 131: These have the form ! 132: .s3 ! 133: .dt ! 134: \fIb# complaint \fB; i= \fIi# \fB(\fIclass \fB)\fR ! 135: .s3 ! 136: Here ! 137: .it b# ! 138: is the block number being considered; ! 139: .it complaint ! 140: is the diagnostic itself. ! 141: It may be ! 142: .s3 ! 143: .lp +8 5 ! 144: \fBblk\fR if the block number was mentioned as an argument ! 145: after ! 146: .bd \*-b; ! 147: .lp +8 5 ! 148: \fBbad\fR if the block number has a value not inside the allocatable space ! 149: on the device, as indicated by the devices's super-block; ! 150: .lp +8 5 ! 151: \fBdup\fR if the block number has already been seen in a file; ! 152: .lp +8 5 ! 153: \fBdin\fR if ! 154: the block is a member of a directory, and if an entry is found ! 155: therein whose i-number is outside the ! 156: range of the i-list on the device, as indicated by the ! 157: i-list size specified by the super-block. ! 158: Unfortunately this diagnostic does not indicate the ! 159: offending entry name, but since the i-number ! 160: of the directory itself is given (see below) ! 161: the problem can be tracked down. ! 162: .s3 ! 163: .i0 ! 164: The ! 165: .it i# ! 166: in the form above is the i-number in which the named block was found. ! 167: The ! 168: .it class ! 169: is an indicator of what type of block was involved in the ! 170: difficulty: ! 171: .s3 ! 172: .lp +8 5 ! 173: \fBsdir\fR indicates that the block is a data block in a small file; ! 174: .lp +8 5 ! 175: \fBldir\fR indicates that the block is a data block in a large file ! 176: (the indirect block number is not available); ! 177: .lp +8 5 ! 178: \fBidir\fR indicates that the block is an indirect block ! 179: (pointing to data blocks) in a large file; ! 180: .lp +8 5 ! 181: \fBfree\fR indicates that the block was mentioned after ! 182: .bd \*-b ! 183: and is free; ! 184: .lp +8 5 ! 185: \fBurk\fR indicates a malfunction in ! 186: .it check. ! 187: .s3 ! 188: .i0 ! 189: When an i-number specified after ! 190: .bd \*-i ! 191: is encountered while reading a directory, ! 192: a report in the form ! 193: .s3 ! 194: \fi# \fBino; i= \fId# \fB(\fIclass \fB) \fIname\fR ! 195: .s3 ! 196: where ! 197: .it i# ! 198: is the requested i-number. ! 199: .it d# ! 200: is the i-number of the directory, ! 201: .it class ! 202: is the class of the directory block as discussed above ! 203: (virtually always ! 204: ``sdir'') ! 205: and ! 206: .it name ! 207: is the entry name. ! 208: This diagnostic gives enough information ! 209: to find a full path name for an i-number ! 210: without using the ! 211: .bd -l ! 212: option: ! 213: use ! 214: .bd \*-b ! 215: .it n ! 216: to find an entry name and ! 217: the i-number of the directory containing the reference to ! 218: .it n, ! 219: then recursively use ! 220: .bd \*-b ! 221: on the i-number of the directory to find its name. ! 222: .s3 ! 223: Another important class of ! 224: file system diseases indicated ! 225: by ! 226: .it check ! 227: is files for which the number of directory entries does ! 228: not agree with the link-count field of the i-node. ! 229: The diagnostic is hard to interpret. ! 230: It has the form ! 231: .s3 ! 232: .dt ! 233: .ft I ! 234: i# delta ! 235: .ft R ! 236: .s3 ! 237: Here ! 238: .it i# ! 239: is the i-number affected. ! 240: .it Delta ! 241: is an octal number accumulated in a byte, and thus can have the ! 242: value 0 through 377(8). ! 243: The easiest way (short of rewriting the routine) ! 244: of explaining the significance of ! 245: .it delta ! 246: is to describe how it is computed. ! 247: .s3 ! 248: If the associated i-node is allocated ! 249: (that is, has the ! 250: .it allocated ! 251: bit on) ! 252: add 100 to ! 253: .it delta. ! 254: If its link-count is non-zero, ! 255: add another 100 plus the link-count. ! 256: Each time a directory entry specifying ! 257: the associated i-number is encountered, ! 258: subtract 1 from ! 259: .it delta. ! 260: At the end, ! 261: the i-number and ! 262: .it delta ! 263: are printed if ! 264: .it delta ! 265: is neither 0 nor 200. ! 266: The first case indicates that the i-node was unallocated ! 267: and no entries for it appear; ! 268: the second that it was allocated ! 269: and that the link-count and the number of directory entries agree. ! 270: .s3 ! 271: Therefore (to explain the symptoms of the most common difficulties) ! 272: .it delta ! 273: = 377 (\*-1 in 8-bit, 2's complement octal) ! 274: means that there is a directory entry for an unallocated ! 275: i-node. ! 276: This is somewhat serious and the entry should be be found and removed forthwith. ! 277: .it Delta ! 278: = 201 usually means that a normal, ! 279: allocated i-node has no directory entry. ! 280: This difficulty is much less serious. ! 281: Whatever blocks there are in the file ! 282: are unavailable, but no further damage ! 283: will occur if nothing is done. ! 284: A ! 285: .it clri ! 286: followed by a ! 287: .it "check \*-s" ! 288: will restore the lost space at leisure. ! 289: .s3 ! 290: In general, ! 291: values of ! 292: .it delta ! 293: equal to or somewhat above 0, 100, or 200 ! 294: are relatively innocuous; ! 295: just below these numbers there is danger of ! 296: spreading infection. ! 297: .sh BUGS ! 298: Unfortunately, ! 299: .it "check \*-l" ! 300: on file systems ! 301: with more than 3000 or so files ! 302: does not work because it runs out of core. ! 303: .s3 ! 304: Since ! 305: .it check ! 306: is inherently two-pass in nature, extraneous diagnostics ! 307: may be produced if applied to active file systems. ! 308: .s3 ! 309: It believes even preposterous super-blocks and ! 310: consequently can get core images.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.