Next Previous Contents

2. FAT under Linux

Linux has support for FAT12 and FAT16 filesystems since 0.97. Linux has support for FAT32 since 2.0.34.

The maximum number of clusters in the data area for which FAT12 was assumed was 4086 in 0.97, 4078 in 0.99p8, and first much later, in 2.2.16/2.4.0-test2, the correct value 4084 was used.

Linux recognizes FAT32 by: bytes 22-23 are zero, bytes 36-39 nonzero in the bootsector.

As heuristics to see whether an unknown filesystem really is a FAT filesystem, the following criteria (on the bootsector) have been employed:

(i) The number of FATs (byte 16) is nonzero.

(ii) The cluster size (byte 13) is a power of two.

(iii) The logical sector size (bytes 11-12) is a power of two, at least 512.

(iv) The number of root directory entries (bytes 17-18) is a multiple of the number of directory entries per logical sector.

(v) The disk geometry has a nonzero number of heads (bytes 26-27) and sectors/track (bytes 24-25).

(vi) The number of reserved sectors (bytes 14-15) is nonzero.

(vii) The media descriptor type (byte 21) is f0 or one of f8-ff.

(viii) The FAT starts with the media descriptor byte.

(ix) The FAT does contain the bit for the last cluster, i.e., is not too short.

(x) For FAT32 also: get the fsinfo sector number (bytes 48-49); if this field is zero, take 1. Check both signatures.


Next Previous Contents