Messages in this thread | | | Date | Fri, 22 Aug 1997 13:10:56 +0200 | From | Martin Mares <> | Subject | Re: FAT12 vs FAT16 |
| |
Hi,
> > Also, why doesn't the msdos fs simply look for the "FAT12" or "FAT16" > > string in the superblock? Seems dangerous to guess based on number > > of clusters. > > > > Because in early versions of DOS that string wasn't there. Now if the > string *IS* there it should be heeded, though...
There are the following ways to determine FAT type:
(1) "FAT12" or "FAT16" string in the boot block. Not reliable and not supported in all DOS versions.
(2) "Sector/cluster count rules" -- described for example in the Tech Help. Varies between DOS versions. Even if you know the DOS version, you can still be wrong as the disk might have been formatted on a different version.
(3) Partition type. Seems to be totally ignored by DOS and sometimes very unreliable as DOS's format command doesn't alter this during reformatting (if you create the partition by one DOS version and format it by another one, an inconsistency might arise).
(4) Number of sectors per FAT -- this value must be correct as the root directory position is calculated from it, but it sometimes allows both possibilities (although such cases are very rare).
(5) Number of 0xff's at the start of the FAT. As you can remember, the first two cluster numbers are reserved for special purposes and their FAT entries are set to 0xff with an exception of the first FAT byte which contains a media descriptor. If there are less than 3 0xff's, the FAT must be 12-bit. In other case, both types are possible.
Have a nice fortnight -- Martin `MJ' Mares <mj@gts.cz> http://atrey.karlin.mff.cuni.cz/~mj/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth "Error: Compiler unable to abort!"
| |