home *** CD-ROM | disk | FTP | other *** search
- hardfix (1.02) - heavily damaged disc fixer
-
- NOTE: this program is SHAREWARE. Read the !SHAREWARE file for more info.
-
- hardfix is a disc utility that fixes the errors that can affect the boot
- block, the 2 copies of the map and the root directory without having to scan
- the whole directory tree. These sort of errors generally make the disc
- un-readable or un-writable!
- hardfix can also be used to write the bootblock, map and root directory to a
- file, so that you can always try to restore them in case they are totally
- damaged (ie. absolutely unfixable).
-
-
- Usage
- -----
-
- hardfix [-options] [-[s|r] savefile] [-l logfile] pathname
- -l print the results in "logfile"
- -s save bootblock/map/root sectors to "savefile"
- -r restore bootblock/map/root sectors from "savefile"
- -Q ask before fixing
- -1/-2 force to fix the first/second copy of the map
-
- If the disc is readable, pathname can contain the disc name (eg.
- IDEFS::IDEDisc4.$), otherwise it must contain the disc number (eg.
- IDEFS::4.$).
-
-
- When you need to use it
- -----------------------
-
- hardfix should not be used regularly like fsck, since the errors it fixes are
- usually really uncommon. Moreover fsck recognises most of the errors hardfix
- cures and tells you when it is needed.
- Anyway, you can use it regularly to save the important disc data (ie.
- bootblock, map and root) to a file, so that you will be able to restore them
- if they are completely destroyed for some mysterious reason. Moreover, you
- are adviced to save them before trying to fix the map with fsck or with
- hardfix itself: if the fix is wrong (especially if it aggravates the
- situation!), you can always restore your old data.
- Remember that restoring old maps generally causes many file corruptions! In
- fact, the map is costantly updated while files are saved/deleted, and even
- files that are not updated can be automatically moved around by RISC OS.
- If your map is broken, try to fix it with fsck and hardfix and eventually
- restore an old one only if you are sure there is nothing better to do!
-
-
- The fixable errors
- ------------------
-
- hardfix is able to fix the following errors:
- - bootblock checksum wrong
- - bootblock defect list end marker missing
- - bootblock defect list checksum wrong
- - map cross check wrong
- - map copies different
- - zone checksum wrong (this is the typical cause of unreadable discs)
- - zone free chunk offset wrong
- - zone free linked list wrong (this is the typical cause of unwritable discs)
- - zone not correctly terminated
- - ID too high for the disc shape
- - not sector-aligned object
- - root directory identifiers wrong
- - root checksum wrong
- - root master sequence numbers different
- - root endmarker wrong
- - root reserved bytes not cleared
- - root address wrong
-
- The bootblock errors should never appear, unless your disc is *really*
- damanged or badly formatted, and will probably be useless to try to fix it.
- Moreover it seems that some some disc have been made completely unreadable
- after hardfix 'cured' the bootblock checksum (anyway, reformatting and
- restoring the map and the root directory using hardfix fixed everything!).
- Considering this bad experience I removed the possibility to save the
- bootblock. If you really need it (for example because the disc is unreadable)
- you *must* contact me (sending the saved disc data) and I will try to
- investigate. In old versions of this file I said "you *should* contact the
- author" but someone didn't and...
-
- The map errors are the most common, especially the ones about free lists, but
- can usually be successfully cured.
-
- The root directory errors are generally serious since they usually imply that
- the directory has been completely overwritten. In this case the only choice
- is to restore it from a previously saved file (only the root should be
- restored, not the bootblock and map, too!).
-
- Using the -Q option you will be asked to choose if the error(s) has to be
- fixed or left intact. So you can choose to fix only the map and not the
- bootblock, for example.
- You will always be asked if the fixes has to be applied to the disc (ie. if
- you really want to save the fixed bootblock, map and root directory).
-
-
- The logfile
- -----------
-
- Using the logfile (-l) option is generally really useful: if something
- strange happens, the author will be more helpful if he can see exactly what
- happened and you don't even have to try to explain what happened when you run
- hardfix, the logfile and the saved disc data is usually enough!
- The logfile contains exactly what it is printed to the screen, so it should
- be really small (nearly 1K on a good disc or nearly 5K on a quite corrupted
- one).
- You cannot save the logfile to the disc to fix!
- If a file with the same name of the logfile already exists, the new data will
- be attached at the end of it: in this way, you can attach together two or
- more logfiles.
-
-
- Notes
- -----
-
- If the two copies of the map are different, hardfix tries to fix the less
- damaged. If they are apparently damaged at the same level, hardfix will ask
- you which map to fix. In normal cases, you are adviced to fix the map that
- hardfix suggests or, by default, choose the first one.
- The -1 and -2 options can be used to force hardfix to try to fix the first or
- the second copy, regardless of their state.
-
-
- Saved file format
- -----------------
-
- This is only of interest to people who wants to access to the saved file in
- their own programs (probably nobody!).
- The saved file has a header that contains the filesystem informations
- followed by a series of tagged object.
- The header consists of the filesystem name followed by a newline and then the
- disc number followed by another newline.
- Each tagged object consists of a textual tag of 4 bytes followed by the
- object itself. The currently recognised tags are:
- "BOOT" - bootblock (512 bytes)
- "MAP1" - the first copy of the map (the length can be calculated from the
- bootblock data)
- "MAP2" - the second copy of the map (the same length as the first copy)
- "ROOT" - the root directory (2048 bytes)
- "RSiX" - the RISCiX partition table (only if RISCiX partitioned!) (256 bytes)
-
- The bootblock must always come before the map, otherwise the length of the
- map cannot be calculated. Only 800K floppies have no bootblock: in this case
- the length of the map is 1024 bytes.
- The second copy of the map must always follow the first one.
- Any other tag is ignored and the file is scanned until a recognised tag is
- found. The tags should be word aligned (the alignement refers to the first
- tag even if it isn't actually word aligned inside the file because of the
- filesystem name).
-
-
- Disclaimer
- ----------
-
- hardfix can be considered a really dangerous program since it can directly
- write to the bootblock, map and root directory: these are the key sectors of
- a disc, damaging them can result in the complete or partial loss of the data
- on the disc.
- I tried most of the features of hardfix on my disc and on some floppies but I
- cannot be completely sure it will work on your disc, too. Always save the
- data using the -s option before trying to fix the disc and remember that it's
- generally better not to fix the bootblock (actually it isn't possible...).
- Anyway, if something goes wrong, I am sorry for you but I AM NOT RESPONSIBLE
- for any loss of data on your discs, so use hardfix at your own risk.
-
-
- Limitations
- -----------
-
- I think that hardfix is able to cure almost every 'fixable' error: this means
- that it cannot fix a completely damaged disc (ie. if both copies of the map
- are overwritten by some random data it can't do nothing apart from restoring
- a saved file).
- hardfix cannot join two adjacent free chunks but I don't think this is a
- problem.
- This limitation could be fixed in future versions.
-
-
- Bugs
- ----
-
- hardfix may have problems with RISCiX partitioned drives: if you have such a
- drive and if hardfix wants to fix a map that seems to be good (try CheckMap
- and fsck on it) don't let it write the map back to disc!
-
-
- Results achieved up to now
- --------------------------
-
- If you run hardfix on your corrupted HD, please let me know! If it wasn't
- able to fix it, I'll try to modify it to cope with your problem. If you want
- to stay anonymous tell me not to include your name.
-
- Positive results:
- 1) some 800K ADFS floppy (used during development).
- 2) my 16Mb IDE that I damaged just to see if hardfix worked on it!
- 3) 203Mb IDE. Owner: L. Domisse
- 4) 87Mb SCSI (Lingenuity interface). Owner: S. Kock
- 5) 327Mb SCSI (Acorn interface). Owner: C. Ghezzi
- 6) 80Mb SCSI (Lingenuity interface). Owner: N. Bannon
- 7) many experiments on my 545Mb IDE (Risc PC), so that now RISC OS
- recognises it as a 545Mb drive even if only 400Mb are formatted...
-
- I don't think that hardfix will ever have a long list of fixed disc...
-
- Negative results:
- 1) 116Mb IDE (Desktop Projects interface). Owner: A.D. Hodgkinson
- Trying to fix the bootblock (the checksum was wrong, apparently it has
- always been wrong...), the disc was made completely unreadable. The
- disc was then formatted and hardfix was able to restore the map and the
- root directory (so that all the disc content was restored!).
- 2) 210Mb IDE (Risc PC). Owner: P.B. Trying to fix the bootblock, the defect
- list was corrupted and the disc became completely unreadable/unwritable.
- This problem no more occurs in version > 1.00.
-
- I hope that hardfix will never have a long list of failures too!
-
-
- History
- -------
-
- 1.00 First released version.
- 1.01 Cured a bug that in some case prevented to fix some strange case of
- lost free space in some zone. When restoring the map it tries not to
- read the disc shape from the disc itself (because it may be corrupted)
- but uses the saved one. Removed the possibility to write the bootblock
- to disc since it could be dangerous. Added fix of too high ID and not
- sector-aligned objects. Fixed some problem with RISCiX partitioned
- bootblocks and with bad defect list (not really useful since the
- ability to fix bootblocks has been removed!). Added fix of root
- address and root reserved bytes.
- 1.02 Fixed defect list checksum calculation that was broken if there was
- only one defect. Improved handling of non-ADFS partitioned discs.
-
-
- Thanks go to:
- -------------
-
- - Laurent Domisse who pushed me to write this program to fix his unreadable
- disc (and then unwritable, too!)
- - Hans Ole Rafaelsen who tried hardfix on 1.6Mb floppies.
-
-
- Conditions of use
- -----------------
-
- hardfix can only be distributed with the complete fsck suite.
- Read the !SHAREWARE file for the conditions of use and distribution of the
- whole package.
-
-
- I can be contacted at the following address:
-
- Sergio Monesi
- Via Trento e Trieste 30
- 20046 Biassono (MI)
- Italy
-
- E-mail address:
- pel0015@cdc8g5.cdc.polimi.it
- If you don't receive a reply (or if the message is bounced) I can also be
- contacted at:
- sergio@freebsd.first.gmd.de
- or:
- sergio@phantom.com
-
- WWW:
- http://cdc8g5.cdc.polimi.it/~pel0015/
-