Page 1 of 1
How to recognize FAT12/FAT16/FAT32 ?
Posted: Tue Feb 26, 2013 9:01 pm
by trinopoty
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.
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 2:43 am
by egos
FAT12/FAT16 - by number of clusters (size of file data area div cluster size).
FAT32 - by specific BPB+ structure.
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 4:28 am
by iansjack
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 5:29 am
by trinopoty
I tried searching on google (with different keywords).
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 6:07 am
by egos
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).
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 8:32 am
by qw
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 9:20 am
by egos
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".
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 9:44 am
by qw
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).
Re: How to recognize FAT12/FAT16/FAT32 ?
Posted: Wed Feb 27, 2013 10:09 am
by egos
Hobbes wrote:To know the specific BPB+ structure, you need to know the exact FAT version first.
No, I can detect this primarily.