FAT file system

Index
In the second half of 2002 I had an Operating System class at Uni. I was disappointed that our class only devoted an hour or two at the most to file system design and never got past discussing basic theory. So I read up on some of the file systems that I'd heard of and ended up writing this after having difficulty finding a clear complete summary of the FAT file system.

Since then I've added some of the content here to the File Allocation Table page on Wikipedia. If you want to learn more I suggest you go there as that page is more likely to be updated than this one.

Introduction

The File Allocation Table (FAT) file system used by MS-DOS and Windows is based around two structures. The File Allocation Table (FAT) which stores the location of the data blocks of the files and the Directory Table which maintains the directory structure of the file system.

FAT Table

The available space on hard drives is divided up into clusters. A single file on the hard drive may store its data in one or more of these clusters, as many as are required by its size. Each cluster on the hard drive is represented by an entry in what is called the FAT table. An entry within the FAT table basically indicates one of three things. Either it contains a value that indicates the location of the next data cluster of the file or a special End Of File (EOF) character that indicates the represented cluster is the last data cluster of the file or a zero value to indicate that the represented cluster is empty.

Directory Table Entry

A directory in MS-DOS FAT is a special file with a table structure. Each entry (32 bytes long) within the table represents a file or another directory. These entries hold metadata about the file such as the file's name, extension and attributes (e.g. hidden, archived), date and time the file/directory was created, the size of the file and the cluster number of the first cluster of the file's data.

FAT16 Directory Table Entry Structure

MetaData Size
name 8 bytes
extension 3 bytes
attributes 1 bytes
reserved 10 bytes
time 2 bytes
date 2 bytes
first data block number 2 bytes
size 4 bytes

Difference between FAT16 and FAT32

History

1996: FAT32 debuts in Windows 95 OEM Service Release 2.
1981: FAT16 debuts with MS-Dos.
1977: Bill Gates and Marc McDonald write the first version of FAT, during the development of "Microsoft Disk Basic".

Sources

Operating System Concepts by Abraham Silberschatz, Baer Peter Galvin & Greg Gagne
Modern Operating Systems by Andrew S. Tanenbaum
Long Filename Specification by vinDaci
FAT32 Resource Page by Andrew Pitt
William H. Gates by Dr. Keith Poole
FAT32 on MSDN
FAT16 and FAT12 on MSDN