home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / mag_discs / 17 / fsck / hard_help < prev    next >
Text File  |  1995-06-11  |  11KB  |  268 lines

  1. hardfix (1.02) - heavily damaged disc fixer
  2.  
  3. NOTE: this program is SHAREWARE. Read the !SHAREWARE file for more info.
  4.  
  5. hardfix is a disc utility that fixes the errors that can affect the boot
  6. block, the 2 copies of the map and the root directory without having to scan
  7. the whole directory tree. These sort of errors generally make the disc
  8. un-readable or un-writable!
  9. hardfix can also be used to write the bootblock, map and root directory to a
  10. file, so that you can always try to restore them in case they are totally
  11. damaged (ie. absolutely unfixable).
  12.  
  13.  
  14. Usage
  15. -----
  16.  
  17. hardfix [-options] [-[s|r] savefile] [-l logfile] pathname
  18.   -l   print the results in "logfile"
  19.   -s   save bootblock/map/root sectors to "savefile"
  20.   -r   restore bootblock/map/root sectors from "savefile"
  21.   -Q   ask before fixing
  22.  -1/-2 force to fix the first/second copy of the map
  23.  
  24. If the disc is readable, pathname can contain the disc name (eg.
  25. IDEFS::IDEDisc4.$), otherwise it must contain the disc number (eg.
  26. IDEFS::4.$).
  27.  
  28.  
  29. When you need to use it
  30. -----------------------
  31.  
  32. hardfix should not be used regularly like fsck, since the errors it fixes are
  33. usually really uncommon. Moreover fsck recognises most of the errors hardfix
  34. cures and tells you when it is needed.
  35. Anyway, you can use it regularly to save the important disc data (ie.
  36. bootblock, map and root) to a file, so that you will be able to restore them
  37. if they are completely destroyed for some mysterious reason. Moreover, you
  38. are adviced to save them before trying to fix the map with fsck or with
  39. hardfix itself: if the fix is wrong (especially if it aggravates the
  40. situation!), you can always restore your old data.
  41. Remember that restoring old maps generally causes many file corruptions! In
  42. fact, the map is costantly updated while files are saved/deleted, and even
  43. files that are not updated can be automatically moved around by RISC OS.
  44. If your map is broken, try to fix it with fsck and hardfix and eventually
  45. restore an old one only if you are sure there is nothing better to do!
  46.  
  47.  
  48. The fixable errors
  49. ------------------
  50.  
  51. hardfix is able to fix the following errors:
  52. - bootblock checksum wrong
  53. - bootblock defect list end marker missing
  54. - bootblock defect list checksum wrong
  55. - map cross check wrong
  56. - map copies different
  57. - zone checksum wrong (this is the typical cause of unreadable discs)
  58. - zone free chunk offset wrong
  59. - zone free linked list wrong (this is the typical cause of unwritable discs)
  60. - zone not correctly terminated
  61. - ID too high for the disc shape
  62. - not sector-aligned object
  63. - root directory identifiers wrong
  64. - root checksum wrong
  65. - root master sequence numbers different
  66. - root endmarker wrong
  67. - root reserved bytes not cleared
  68. - root address wrong
  69.  
  70. The bootblock errors should never appear, unless your disc is *really*
  71. damanged or badly formatted, and will probably be useless to try to fix it.
  72. Moreover it seems that some some disc have been made completely unreadable
  73. after hardfix 'cured' the bootblock checksum (anyway, reformatting and
  74. restoring the map and the root directory using hardfix fixed everything!).
  75. Considering this bad experience I removed the possibility to save the
  76. bootblock. If you really need it (for example because the disc is unreadable)
  77. you *must* contact me (sending the saved disc data) and I will try to
  78. investigate. In old versions of this file I said "you *should* contact the
  79. author" but someone didn't and...
  80.  
  81. The map errors are the most common, especially the ones about free lists, but
  82. can usually be successfully cured.
  83.  
  84. The root directory errors are generally serious since they usually imply that
  85. the directory has been completely overwritten. In this case the only choice
  86. is to restore it from a previously saved file (only the root should be
  87. restored, not the bootblock and map, too!).
  88.  
  89. Using the -Q option you will be asked to choose if the error(s) has to be
  90. fixed or left intact. So you can choose to fix only the map and not the
  91. bootblock, for example.
  92. You will always be asked if the fixes has to be applied to the disc (ie. if
  93. you really want to save the fixed bootblock, map and root directory).
  94.  
  95.  
  96. The logfile
  97. -----------
  98.  
  99. Using the logfile (-l) option is generally really useful: if something
  100. strange happens, the author will be more helpful if he can see exactly what
  101. happened and you don't even have to try to explain what happened when you run
  102. hardfix, the logfile and the saved disc data is usually enough!
  103. The logfile contains exactly what it is printed to the screen, so it should
  104. be really small (nearly 1K on a good disc or nearly 5K on a quite corrupted
  105. one).
  106. You cannot save the logfile to the disc to fix!
  107. If a file with the same name of the logfile already exists, the new data will
  108. be attached at the end of it: in this way, you can attach together two or
  109. more logfiles.
  110.  
  111.  
  112. Notes
  113. -----
  114.  
  115. If the two copies of the map are different, hardfix tries to fix the less
  116. damaged. If they are apparently damaged at the same level, hardfix will ask
  117. you which map to fix. In normal cases, you are adviced to fix the map that
  118. hardfix suggests or, by default, choose the first one.
  119. The -1 and -2 options can be used to force hardfix to try to fix the first or
  120. the second copy, regardless of their state.
  121.  
  122.  
  123. Saved file format
  124. -----------------
  125.  
  126. This is only of interest to people who wants to access to the saved file in
  127. their own programs (probably nobody!).
  128. The saved file has a header that contains the filesystem informations
  129. followed by a series of tagged object.
  130. The header consists of the filesystem name followed by a newline and then the
  131. disc number followed by another newline.
  132. Each tagged object consists of a textual tag of 4 bytes followed by the
  133. object itself. The currently recognised tags are:
  134. "BOOT" - bootblock (512 bytes)
  135. "MAP1" - the first copy of the map (the length can be calculated from the
  136.          bootblock data)
  137. "MAP2" - the second copy of the map (the same length as the first copy)
  138. "ROOT" - the root directory (2048 bytes)
  139. "RSiX" - the RISCiX partition table (only if RISCiX partitioned!) (256 bytes)
  140.  
  141. The bootblock must always come before the map, otherwise the length of the
  142. map cannot be calculated. Only 800K floppies have no bootblock: in this case
  143. the length of the map is 1024 bytes.
  144. The second copy of the map must always follow the first one.
  145. Any other tag is ignored and the file is scanned until a recognised tag is
  146. found. The tags should be word aligned (the alignement refers to the first
  147. tag even if it isn't actually word aligned inside the file because of the
  148. filesystem name).
  149.  
  150.  
  151. Disclaimer
  152. ----------
  153.  
  154. hardfix can be considered a really dangerous program since it can directly
  155. write to the bootblock, map and root directory: these are the key sectors of
  156. a disc, damaging them can result in the complete or partial loss of the data
  157. on the disc.
  158. I tried most of the features of hardfix on my disc and on some floppies but I
  159. cannot be completely sure it will work on your disc, too. Always save the
  160. data using the -s option before trying to fix the disc and remember that it's
  161. generally better not to fix the bootblock (actually it isn't possible...).
  162. Anyway, if something goes wrong, I am sorry for you but I AM NOT RESPONSIBLE
  163. for any loss of data on your discs, so use hardfix at your own risk.
  164.  
  165.  
  166. Limitations
  167. -----------
  168.  
  169. I think that hardfix is able to cure almost every 'fixable' error: this means
  170. that it cannot fix a completely damaged disc (ie. if both copies of the map
  171. are overwritten by some random data it can't do nothing apart from restoring
  172. a saved file).
  173. hardfix cannot join two adjacent free chunks but I don't think this is a
  174. problem.
  175. This limitation could be fixed in future versions.
  176.  
  177.  
  178. Bugs
  179. ----
  180.  
  181. hardfix may have problems with RISCiX partitioned drives: if you have such a
  182. drive and if hardfix wants to fix a map that seems to be good (try CheckMap
  183. and fsck on it) don't let it write the map back to disc!
  184.  
  185.  
  186. Results achieved up to now
  187. --------------------------
  188.  
  189. If you run hardfix on your corrupted HD, please let me know! If it wasn't
  190. able to fix it, I'll try to modify it to cope with your problem. If you want
  191. to stay anonymous tell me not to include your name.
  192.  
  193. Positive results:
  194.  1) some 800K ADFS floppy (used during development).
  195.  2) my 16Mb IDE that I damaged just to see if hardfix worked on it!
  196.  3) 203Mb IDE. Owner: L. Domisse
  197.  4) 87Mb SCSI (Lingenuity interface). Owner: S. Kock
  198.  5) 327Mb SCSI (Acorn interface). Owner: C. Ghezzi
  199.  6) 80Mb SCSI (Lingenuity interface). Owner: N. Bannon
  200.  7) many experiments on my 545Mb IDE (Risc PC), so that now RISC OS
  201.     recognises it as a 545Mb drive even if only 400Mb are formatted...
  202.  
  203. I don't think that hardfix will ever have a long list of fixed disc...
  204.  
  205. Negative results:
  206.  1) 116Mb IDE (Desktop Projects interface). Owner: A.D. Hodgkinson
  207.     Trying to fix the bootblock (the checksum was wrong, apparently it has
  208.     always been wrong...), the disc was made completely unreadable. The
  209.     disc was then formatted and hardfix was able to restore the map and the
  210.     root directory (so that all the disc content was restored!).
  211.  2) 210Mb IDE (Risc PC). Owner: P.B. Trying to fix the bootblock, the defect
  212.     list was corrupted and the disc became completely unreadable/unwritable.
  213.     This problem no more occurs in version > 1.00.
  214.  
  215. I hope that hardfix will never have a long list of failures too!
  216.  
  217.  
  218. History
  219. -------
  220.  
  221. 1.00   First released version.
  222. 1.01   Cured a bug that in some case prevented to fix some strange case of
  223.        lost free space in some zone. When restoring the map it tries not to
  224.        read the disc shape from the disc itself (because it may be corrupted)
  225.        but uses the saved one. Removed the possibility to write the bootblock
  226.        to disc since it could be dangerous. Added fix of too high ID and not
  227.        sector-aligned objects. Fixed some problem with RISCiX partitioned
  228.        bootblocks and with bad defect list (not really useful since the
  229.        ability to fix bootblocks has been removed!). Added fix of root
  230.        address and root reserved bytes.
  231. 1.02   Fixed defect list checksum calculation that was broken if there was
  232.        only one defect. Improved handling of non-ADFS partitioned discs.
  233.  
  234.  
  235. Thanks go to:
  236. -------------
  237.  
  238. - Laurent Domisse who pushed me to write this program to fix his unreadable
  239.   disc (and then unwritable, too!)
  240. - Hans Ole Rafaelsen who tried hardfix on 1.6Mb floppies.
  241.  
  242.  
  243. Conditions of use
  244. -----------------
  245.  
  246. hardfix can only be distributed with the complete fsck suite.
  247. Read the !SHAREWARE file for the conditions of use and distribution of the
  248. whole package.
  249.  
  250.  
  251. I can be contacted at the following address:
  252.  
  253. Sergio Monesi
  254. Via Trento e Trieste 30
  255. 20046 Biassono (MI)
  256. Italy
  257.  
  258. E-mail address:
  259. pel0015@cdc8g5.cdc.polimi.it
  260. If you don't receive a reply (or if the message is bounced) I can also be
  261. contacted at:
  262. sergio@freebsd.first.gmd.de
  263. or:
  264. sergio@phantom.com
  265.  
  266. WWW:
  267. http://cdc8g5.cdc.polimi.it/~pel0015/
  268.