Documentation for The VTOC Fixer! By Robert Puff 11/27/88 Have you ever had files suddenly "go bad" on your hard disk? Or perhaps a blank file entry? There are several problems that can arise with both floppy and hard disks as time goes by - sometimes because the DOS gets corrupted, other times because of user error. That's where the VTOC Fixer comes into play! It was designed for MYDOS-formatted hard disks, but can probably work just as well on any DOS 2 compatible disk. The VTOC Fixer will go through every file (in every subdirectory) on the specified drive, looking for any possible problems. It also re-creates the VTOC table (and free sector count), and at the end verifies its table to the one recorded on the disk. If there are any mismatches, you will be informed, and can write out the corrected VTOC. Here are the things the VTOC Fixer looks for, and will recover: 1.) Any "bad" filename: a filename that is not a legal DOS filename. (This includes inverse, control characters, and a space or number as the first character of the name.) 2.) Bad sectors on the disk. A bad sector in the middle of a disk (especially on a hard disk) can cause the DOS will produce an error when you write to the disk, thus making it impossible to add any additional files to the drive. Normally the procedure to clear up this problem is to copy all files to another drive, and re-format the disk. But in the case of a large hard disk, this is not always practical. The VTOC Fixer will delete any file containing a bad sector, and will mark that sector as being used in the VTOC, so the DOS will never try to access it again. 3.) Bad links in a file. The next sector link at the end of every sector occasionally will reflect a wrong sector number, causing an error 139 upon accessing this file. The VTOC Fixer will delete the file, and free up any sectors allocated to it (even if the file link is in the middle or beginning of the file). This is the "BAD RANGE" error, and occurs when the sector number is less than 4 or greater than the maximum sector on the disk. 4.) Looped files. A corrupted DOS may cause a file to point back to itself, causing an apparent "lockup" whenever the file is deleted or copied. The VTOC Fixer will delete the file, and free up all sectors allocated to it. This is the "LOOP ERR". 5.) Colliding files. A bad VTOC table can cause files to run into each other. Most often, this will produce a "LENGTH ERROR" described below. However, if the file contains any sectors that have been previously used by VTOC, directory, or other file data, it will produce a "COLLISION" error. The file will be deleted, and all non-colliding sectors will be freed. 6.) Bad length files. This is the most frequent error you will probably see. When two files collide with each other, the original file's data is replaced with the new file. Due to the nature of sector linking, reading the first file will eventually end up in reading part (or all) of the second file. This will cause a "BAD LENGTH" error, which means the sector length as is listed in the directory is not the same length as the file. The first (original file) will produce this error; the second file will be fine. The VTOC Fixer will delete the (first) file, and de-allocate any sectors not belonging to the second file. 7.) Bad versions of DOS. Any version of MYDOS prior to 4.50 contained a bug dealing with formatting large capacity disks (hard disks). When you entered the sector count, it did not always store the number you entered correctly. This gave false free sector counts, generally +/- 200 sectors from what it should have been. The VTOC Fixer first determines exactly how many sectors are on the disk, then bases its calculations on this number. This is listed in the "Init. free secs correction" given at the end of the processing. 8.) Ignores old VTOC table. The VTOC Fixer generates its own VTOC; it never reads the one on your disk except for comparison. So if only the VTOC was blown away for some reason, you will not lose anything. How to use The VTOC Fixer Load VTOCFIX.COM from your DOS menu as a binary file. Now type the drive number you wish to fix, or press RETURN to go back to DOS. The drive should NOT be write protected. The prompt "Verify files to delete?" will appear. Answering "Y" to this (which is recommended) will cause the program to prompt you before it deletes or writes anything to your disk. (For example, if it wants to delete a file you really want to keep - but remember, the file probably is bad.) Otherwise, pressing "N" or RETURN will cause the VTOC Fixer to correct any errors automatically, without user intervention. The program will now attempt to calculate the total number of sectors on that drive total. (This applies mostly to hard disk users, but is applicable for any type of floppy drive.) If the number returned does not look good, you may change it by answering "N", and typing in your own value. The VTOC Fixer will attempt to read this sector to insure this value is correct. If it cannot, you will be prompted for anoter value. Try a number 1 less than before, and keep decreasing till it accepts the number. On SUPRA 20 meg hard disks, contrary to what they say, you have 36799 sectors for drives 3 and 4 (one less than the 36800). In the future, keep this number (the maximum sector number) in an important place, so when you reconfigure new versions of MYDOS, you can use the correct value. Now the program will begin the long, drawn-out process of going through every file. It lists the entire filename of the file it is processing, in directory-style (no period between name and extender). If your screen goes into attract mode, simply hit SHIFT CONTROL A. These are the following errors that may occur in a file: COLLISION - the file has a sector that has already been used by another file, VTOC, or directory. BAD LENGTH - The directory length does not compare to the actual file length: probably a result of a collision. LOOP ERR - the file "loops" back to itself. BAD RANGE - The sector link points to a sector less than 4 or greater than what is available on the disk. Err #144 @ Sec #xxx - A bad sector on your disk. INVALID FILENAME:xxx - an illegal filename (bad bytes). Any bad files SHOULD be deleted by this program. If they are not, they will be overwritten by files written TO the disk in the future. At the end, the VTOC Fixer will display the number of sectors used in files (not really that meaningful), the number of sectors that are now free (the newly-generated free sector count), the old free sector count (so you can see the difference if any), and the initial free sector correction (caused by an incorrect format to begin with). If your VTOC and free sector count agree with the value the program calculated, it will be displayed. Otherwise, it will ask you if you wish to write out the new VTOC. You SHOULD answer "Y" to this question, which will correct the errors. If for any reason you do not want this, type "N" or RETURN. And that's it! This program in essence takes the place of copying all files to another disk, formatting the original, and copying the files back. Run this whenever you think a drive might not be set-up right, or have a bad free sector count. You cannot hurt the drive by running this - it can only help! It has really helped me, and saved alot of hard disks here. Enjoy! If you have any further questions, comments, or want to send a donation to encourage me to continue bring quality software into the public domain, please feel free to write. Bob Puff Suite 222 2117 Buffalo Rd. Rochester, NY 14624