home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsf / fsck / fsck_help < prev    next >
Text File  |  1995-01-31  |  20KB  |  413 lines

  1. fsck (1.21) - map fixer and analyst
  2.  
  3. NOTE: this program is SHAREWARE. Read the !SHAREWARE file for more info.
  4.  
  5. fsck is a disc utility that fixes the map of an E-Format disc (hard or
  6. floppy) if it is corrupted for some obscure reasons. fsck can also report
  7. some informations about the way the files are allocated (such as the bytes
  8. lost because of sectors boundaries) and eventually print a detailed
  9. description of the map and directories organization.
  10. fsck can also be considered as a replace of the *CheckMap command because it
  11. is faster, less prone to crash and can give useful informations on the files
  12. allocation.
  13.  
  14.  
  15. Usage
  16. -----
  17.  
  18. fsck [-options] [-d lostdir] [-l logfile] [pathname]
  19. Most used options:
  20.   -s   calculate statistics
  21.   -f   try to fix map if broken
  22.   -l   print the results in "logfile"
  23. Less used options:
  24.   -h   print help informations
  25.   -d   link broken part of map in directory "lostdir"
  26.   -v   print files location (-vv print also files position in zones)
  27.   -D   just display disc information recorded in the map header
  28.   -q   don't display disc information (quiet mode)
  29.   -c   produce output like *CheckMap
  30.   -m   ask the user to eventually move files instead of changing map
  31.   -n   don't try to recognise directories
  32.  
  33. The default directory where files are linked is "$.lost+found".
  34. If 'pathname' is not specified, the current disc is analysed.
  35. If 'pathname' is not a root directory (eg. ADFS::0.$.Library), fsck checks
  36. only that directory and so it cannot tell you if the map is good or broken.
  37. This could be useful if you want to know the statistics of a single directory
  38. instead of the whole disc. If the -f option is used, the disc is scanned from
  39. the root directory, regardless of 'pathname'.
  40. The -m and -n options used together cause fsck 1.20 or later to work like
  41. fsck 1.13 or earlier.
  42.  
  43.  
  44. What it does (or tries to do...)
  45. --------------------------------
  46.  
  47. fsck scans the directory tree and checks the map to see if every file
  48. registered in the map actually exists in a directory. If not, it creates that
  49. file in a directory so that you will be able to delete it in the normal way.
  50. If the file was originally a directory, fsck tries to relink it
  51. reconstructing the directory name and content. Even if you want to keep the
  52. relinked files or directories, you should copy them and delete the original
  53. one, because there is the risk that your map will be corrupted again,
  54. especially if you try to change them.
  55. Apart from directories and their content, the re-linked files are usually
  56. longer than the original lost file because fsck always links whole sectors
  57. (and there is no way to know the original length), their filenames are random
  58. and filetypes always &FFF (Text).
  59.  
  60. Using the -m option, fsck could tell you that an ID is regularly allocated
  61. for another file and you have to delete it (moving the file to another
  62. directory isn't enough, you have to copy it and delete the original) and run
  63. fsck again. Without this option, fsck will change the ID in the map and
  64. rewrite it to disc. The -m option is in fact only useful if you prefer not to
  65. modify your map: anyway, remember that moving files on a corrupted disc can
  66. be quite dangerous and can eventually corrupt other parts of the disc.
  67. Sometimes the disc may be so corrupted that you will need to run fsck more
  68. than once, the program itself will tell you if a re-run is needed.
  69.  
  70.  
  71. The logfile
  72. -----------
  73.  
  74. Using the logfile (-l) option is generally really useful: if something
  75. strange happens, the author will be more helpful if he can see exactly what
  76. happened and you don't even have to try to explain what happened when you run
  77. fsck, the logfile is usually enough!
  78. The logfile contains exactly what it is printed to the screen: unless you use
  79. the -v option it will be really small (nearly 2K on a good map or nearly 10K
  80. on a quite corrupted one).
  81. You cannot save the logfile to the disc to analyse.
  82. If a file with the same name of the logfile already exists, the new data will
  83. be attached at the end of it: in this way, you can attach together two or
  84. more logfiles.
  85.  
  86.  
  87. fsck and Risc PC
  88. ----------------
  89.  
  90. fsck and CheckMap are no more equivalent on Risc PCs! In fact, Acorn changed
  91. some behaviours of the FileCore module in RISC OS 3.50 so that it can now
  92. cope with over-allocated files (ie. files that have allocated more space than
  93. they need). This sort of files on old version of RISC OS causes CheckMap to
  94. say "Map inconsistent" and if you try to delete such files you will lose some
  95. space. On RISC OS 3.50 CheckMap no more says "Map inconsistent" if
  96. over-allocated files are the only map problem and deleting them no more
  97. causes lost space. Compliment Acorn!
  98. fsck still reports map corruptions in this case (on every version of RISC OS)
  99. since an over-allocated file can be considered a problem (think at a 100K
  100. file that uses up 10Mb of disc space and you will understand what I mean!).
  101. Anyway, on a Risc PC, using the -m option you can be able to discover such
  102. files and you can fix the disc (assuming that your map is corrupted only
  103. because of over-allocated files) just moving them.
  104. Remember that using the -f option fsck can cure the disc without moving any
  105. file on every version of RISC OS.
  106.  
  107.  
  108. Return values
  109. -------------
  110.  
  111. This paragraph can be interesting only for programmers who want to write
  112. some program/frontend that has to interface with fsck.
  113.  
  114. fsck returns to RISC OS a value that is 0 only if fsck was able to scan the
  115. disc and the map is good, otherwise it returns 1.
  116. fsck also sets the numeric system variable fsck$ReturnCode to a value that
  117. can be more helpful to determine why fsck failed or 0 if the map was good.
  118. The value is formed by the following bits:
  119.  
  120. enum {
  121.   return_MAPGOOD          = 0x00000000,   /* the map is good (!) */
  122.  
  123.   return_MAP_BROKEN       = 0x00000001,   /* the map is broken, fsck -f should fix it */
  124.   return_MAP_FIXED        = 0x00000002,   /* the map was broken but has been fixed */
  125.   return_MAP_UNFIXABLE    = 0x00000004,   /* the map seems to be unfixable... */
  126.   return_NEED_ELIMINATE   = 0x00000010,   /* need eliminate to fix the map */
  127.   return_NEED_HARDFIX     = 0x00000020,   /* need hardfix to fix the map */
  128.   return_NO_ACTION        = 0x00000100,   /* no useful action performed (eg. fsck -h) */
  129.   return_PARAM_ERROR      = 0x00000200,   /* bad input parameters */
  130.   return_WRONG_FS         = 0x00000400,   /* wrong file system name, disc name, number, etc. */
  131.   return_IO_ERROR         = 0x00000800,   /* error while reading/writing disc, directories, etc. */
  132.   return_MEMORY_FULL      = 0x00001000    /* not enough free memory */
  133. };
  134.  
  135. You can expect that every possible conbination of that values is returned (ie.
  136. &30 means that both 'eliminate' and 'hardfix' are needed) even if generally
  137. only one error number is returned.
  138. If you are writing a 'C' program that has to call fsck you can use something
  139. like this:
  140.  
  141.  if (system("fsck ...")==0) {
  142.    /* map good */
  143.  }
  144.  else {
  145.    /* some problem occurred (not necessairily map broken!) */
  146.    /* check fsck$ReturnCode for more informations */
  147.  }
  148.  
  149. If you don't want (or can't) check the return status you just check the value
  150. of fsck$ReturnCode.
  151.  
  152.  
  153. Notes
  154. -----
  155.  
  156. fsck is 20-30% faster than CheckMap (actually, up to 50% faster on big and
  157. full drives!). If you really like CheckMap's output instead of fsck's one,
  158. you can use the -c option so that fsck will print the directory tree as it
  159. proceeds with the scan. You can eventually include the following alias in
  160. your boot sequence so that you can still write 'CheckMap' even if 'fsck' is
  161. the command actually executed (fsck should be reachable via Run$Path, for
  162. example, put it in the Library directory):
  163. Set Alias$CheckMap "fsck -c "       [try "fsck -s " for a more useful output]
  164.  
  165. Anyway, fsck can also be used to show the "Free space chunks
  166. statistics" or to calculate some statistics about the files allocation using
  167. the -s option (not in conjunction with -c, though).
  168. The "Free space chunks statistics" are always shown unless the -q or -c
  169. options have been specified: in general, with a high number of (small) free
  170. space chunks, RISC OS will be slower when saving files because it will try to
  171. do an auto-Compact and (this is my personal opinion) there w