This may be a silly question.
How do I tell if a partition is formatted with FAT12/FAT16/FAT32 by analyzing the first sector of the partition (in software) ?
I do not need any code examples, just the principle to use.
How to recognize FAT12/FAT16/FAT32 ?
How to recognize FAT12/FAT16/FAT32 ?
Always give a difficult task to a lazy person. He will find an easy way to do it.
Re: How to recognize FAT12/FAT16/FAT32 ?
FAT12/FAT16 - by number of clusters (size of file data area div cluster size).
FAT32 - by specific BPB+ structure.
FAT32 - by specific BPB+ structure.
If you have seen bad English in my words, tell me what's wrong, please.
Re: How to recognize FAT12/FAT16/FAT32 ?
In a bit more detail: http://homepage.ntlworld.com/jonathan.d ... idths.html
(Isn't Google wonderful.)
(Isn't Google wonderful.)
Re: How to recognize FAT12/FAT16/FAT32 ?
I tried searching on google (with different keywords).
Always give a difficult task to a lazy person. He will find an easy way to do it.
Re: How to recognize FAT12/FAT16/FAT32 ?
Cluster xF6h is incorrect. Value xF6h is used to mark reserved clusters in many extensions. FAT Spec. says that max count of clusters is xF4h (xF6h-2).iansjack wrote:In a bit more detail: http://homepage.ntlworld.com/jonathan.d ... idths.html
If you have seen bad English in my words, tell me what's wrong, please.
Re: How to recognize FAT12/FAT16/FAT32 ?
The [url=http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc]Microsoft Extensible Firmware Initiative FAT32 File System Specification[/url] wrote:This is the one and only way that FAT type is determined.Code: Select all
if (CountofClusters < 4085) { /* Volume is FAT12 */ } else if (CountofClusters < 65525) { /* Volume is FAT16 */ } else { /* Volume is FAT32 */ }
Re: How to recognize FAT12/FAT16/FAT32 ?
Yes, but FAT32 BPB+ differs from FAT12/FAT16 BPB+. It's not true that FAT12/FAT16 can have FAT32 BPB+. So when you have detected FAT32 you additionally can check condition "number of clusters > 0FFF4h".
If you have seen bad English in my words, tell me what's wrong, please.
Re: How to recognize FAT12/FAT16/FAT32 ?
To know the specific BPB+ structure, you need to know the exact FAT version first.
FAT32 can be distinguished from FAT12/16 by the number of entries in the root directory (word at offset 17 in the BPB) and/or the size of one FAT (word at offset 22) which are always zero on FAT32 and always non-zero on FAT12/16.
If this tells you that the file system is FAT32 but the number of clusters is below 65525, then the volume is corrupt.
The FAT version is not determined by the file system type (eight-byte string at offset 54).
FAT32 can be distinguished from FAT12/16 by the number of entries in the root directory (word at offset 17 in the BPB) and/or the size of one FAT (word at offset 22) which are always zero on FAT32 and always non-zero on FAT12/16.
If this tells you that the file system is FAT32 but the number of clusters is below 65525, then the volume is corrupt.
The FAT version is not determined by the file system type (eight-byte string at offset 54).
Re: How to recognize FAT12/FAT16/FAT32 ?
No, I can detect this primarily.Hobbes wrote:To know the specific BPB+ structure, you need to know the exact FAT version first.
If you have seen bad English in my words, tell me what's wrong, please.