Path: utzoo!utgpu!water!watmath!clyde!feg From: feg@clyde.ATT.COM (Forrest Gehrke) Newsgroups: comp.sys.ibm.pc Subject: Re: How do ya when your FATs corrupt? Summary: Debug is one way Message-ID: <22926@clyde.ATT.COM> Date: 7 Mar 88 19:09:40 GMT References: <9765@shemp.CS.UCLA.EDU> <22568@clyde.ATT.COM> <268@mccc.UUCP> Organization: AT&T Bell Labs, Whippany NJ Lines: 70 In article <268@mccc.UUCP>, pjh@mccc.UUCP (Peter J. Holsberg) writes: > In article <22568@clyde.ATT.COM> feg@clyde.ATT.COM (Forrest Gehrke) writes: > |In article <9765@shemp.CS.UCLA.EDU>, todd@ucla-cs.UUCP writes: > |> I use the Norton utilities to save a copy of my FAT table, but how do I > |> know if the FAT was good to start with? > |> > |There are two copies of FAT. Run a binary compare on them. The probability > |of both being identically corrupted is fairly low. > > How do you do that? Does DOS itself have any use for the 2nd FAT? > I have seen a few rare instances of DOS using the second FAT when something was wrong with the first, but I don't remember the circumstances. You can use DEBUG to get at the FAT's. For a hard disk using 12 bit FAT's 8 sectors per FAT are used. They are sectors 1 thru 8 for the first FAT and sectors 9 thru 16 for the second FAT. (If your disk is using 16 bit FAT's more than 8 sectors are used per FAT). Using the load command of DEBUG (l) load into some unused memory locations the 16 sectors (remember to use hex with DEBUG): l cs:1000 2 1 10 This command will load the 10h sectors of the hard disk starting with sector 1 contiguously into memory starting at location cs:1000. At cs:2000 the second FAT will begin, so using the compare command of DEBUG: c cs:1000l1000 cs:2000 (meaning compare 1000h bytes of memory staring at cs:1000 with the same number of bytes starting at cs:2000 ---- that character between the two 1000 numbers is an l for length) If there are any differences the compare will list the addresses and byte values that exist at the compared locations. Assuming all was OK, if you want to write this into a file on your floppy, for example, do the following: r cx cx:0000 (This is what the DEBUG will come back with) :2000 (You key in the 2000 for the number of bytes you want to write). n a:fats (Naming filename FATS--or whatever on drive a:) w cs:1000 (Write starting at address cs:1000) DEBUG will respond with a message saying it is writing 2000 bytes. q (quit DEBUG) You will now have on your floppy in drive a: a file named FATS having the two FATS of total length decimal 8192 Obviously this is not a very handy procedure, but for those of you proficient in C you will see the FAT information is located on the hard disk. These FAT's will change the next time you add or delete a file. When using the write command of DEBUG, be doubly sure of what you are doing. Avoid writing to the hard disk unless you really know what you are doing--because you may be horribly surprised at the next boot up if you made a mistake (and which may be very difficult to rectify short of a format). Write to a formatted floppy which does not contain anything crucial to you. Forrest Gehrke