File systems 101: FAT

Scott Lowe delivers the first in a series of tutorials on file systems. You may use a technology every day, but do you really know what makes it tick? Get the skinny on FAT.

We all have various technologies that we work with every day and that we take for granted, without really knowing what makes them work. In this article, I am going to give you some basic background information on the FAT file system. This installment will launch a series of articles that I plan to do on various common file systems, including FAT, NTFS, Reiser, JFS, and more. (If there is a particular file system you are interested in learning more about, leave a comment in the discussion area below, and I'll consider it for a part of this series.)

Keep in mind that if you're a file system programmer, these articles may not be for you. If, however, you consider yourself an Average Joe IT pro, you might find the series interesting and useful. To get started, I'll take a look at arguably the most common file system out there: FAT.

Get the skinny on FAT

Developed in 1977 and first introduced in 1980 with QDOS, FAT (File Allocation Table) has undergone some upgrades over the years and is available in three different versions, named FAT12, FAT16, and FAT32. The number in each name refers to the number of bits available for addressing, although FAT32 reserves 4 bits of this addressing space, providing only 28 bits for actual use. FAT’s initial 12-bit addressing scheme limited the file system to a maximum of 4,077 clusters (also known as "allocation units"), while FAT16 increased this limit to 65,536 clusters, and FAT32 to 268,435,438 clusters.

Tips in your inbox
TechRepublic's free Storage NetNote newsletter is designed to help you manage the critical data in your enterprise.
Automatically sign up today!

Before I get into FAT, I’ll explain a couple of terms:

Cluster/Allocation Unit Every FAT-based disk is broken down into a number of clusters, each containing a number of 512-byte disk sectors. Most file systems do not deal directly with the disk sectors, as this would require significant overhead. Instead, sectors are grouped into clusters, which can be anywhere from 2,048 bytes in size to 32,768 bytes in size (4 to 64 clusters). As disks grow larger, the cluster size increases, and, thus, the more disk sectors that are used per cluster. Cluster size directly impacts the maximum size of a disk. For example, if you take a 512-MB disk using FAT16, which can have only a maximum of 65,536 clusters, you are required to use a cluster size of at least 8K (524,288,000 bytes / 65,536 clusters = 8K cluster size). Another example (FAT16: 1 GB disk - 1,048,576,000 bytes / 65,536 clusters = 16K cluster size).

File Allocation Table Not to be confused with the name of the file system itself, the File Allocation Table provides a complete map of how each cluster in the disk is used (or not used, if the cluster is empty).

Cluster waste (Often called "slack") A file is stored using clusters, not using the size of a disk sector. So, suppose you have a disk that is broken up into 32 KB clusters and you save a file that is 33 KB in size. This file will require two full clusters, or a total of 64 KB of disk space, resulting in 31 KB of wasted space, or slack.

FAT12

FAT12 provided no means to support a directory structure and, due to 16-bit counting of sectors, disk size was limited to 32 MB. Understand that sector counting and cluster addressing are different concepts. While FAT12 supported 16-bit sector counting, it still used only 12 bits for cluster addressing. While FAT12 provided theoretical support for many more files, because of FAT12’s initial lack of a directory structure mechanism, the number of files that could be stored was very limited since all files had to be saved to what would eventually become the root directory. The maximum size of an individual file in FAT12 was also 32MB.

Hierarchical directory support was added via MS-DOS 2.0 in 1983, which effectively allowed FAT12-based disks to store more files.

FAT16

FAT12's limitations meant that disks could not grow beyond a certain point, so, in 1984, Microsoft released MS-DOS 3.0's FAT16, which itself underwent a revision in 1987. 1984's release of FAT16 is often called the "initial release", and sometimes even considered an extension to FAT12, while 1987's build is the "final release;" this release is FAT16's common implementation. FAT16's initial release increased cluster addresses to 16-bits, providing the ability to support up to 65,536 clusters (2 ^ 16 clusters). Disk size was still limited to 32 MB, however. The maximum size of an individual file in FAT16 is 2 GB.

1987’s FAT16 update increased the disk sector index to 32 bits. This, along with new ways to counts the clusters and sectors on the disk, resulted in a maximum partition size of 2 GB, although some implementations have pushed this to 4 GB (very uncommon and not recommended). Note here that I use the phrase "partition size" rather than "disk size." Along the way, and separate from FAT development, other developments were also moving forward and the concept of partitions was introduced. I will not be going over partitions in this article.

FAT16, also known as just FAT, is commonly used today on removable media, such as USB drives and media cards.

FAT16 remained the standard file system used from MS-DOS 3.0 all the way up to Windows 95 A. With the 1996 release of Windows 95 B (OSR2), although FAT16 was still supported, Microsoft introduced the new, more efficient FAT32. FAT32 remains supported in all current versions of Windows.

FAT32

FAT32 is probably the most confusing entry into FAT history as it appears that Microsoft has either intentionally crippled the file system in Windows, or they have never truly fully implemented it.

With 28 bits of addressing space available, a FAT32 partition should be able to support up to 268,435,438 (2 ^ 28 bits) clusters, thus providing support for disks/partitions up to 2 TB in size. For some reason, Microsoft never bothered to update their Scandisk utility, thus effectively limiting FAT32 to 4,177,920 (about 2 ^ 22) clusters, placing the volume limit at 124.55 gigabytes. Further, in recent versions of Windows, FAT32 cannot be used for volumes that are larger than 32 GB in size.

One huge improvement in FAT32 is the tremendous increase in the addressing space, which means that you can have larger disks with smaller cluster sizes and avoid as much "slack". However, as the cluster size decreases, the number of entries in the file allocation table increases, meaning that a small cluster size on a FAT32 partition could result in a performance hit.

As a note, Windows NT does not support FAT32.

FAT32 volumes support file sizes of up to 4 GB which, these days, is not adequate for many tasks.

Pros and cons

FAT continues going strong with its use in a lot of removable media. FAT also enjoys widespread operating system support because of its relative simplicity. However, FAT suffers from a number of serious drawbacks that make it unsuitable in many of today’s environments.

  • Lack of permissions: In today’s security-conscious world, a file system without permission capability would be akin to leaving your new Lexus parked in the bad part of town with the keys inside… oh, and the car is full of all of your customer records, too.
  • File size limitations: With video editing, virtualization (meaning huge virtual disks), and other activities, FAT is simply not able to keep up with the demands of today’s users.
  • Lack of encryption: FAT lacks native encryption ability. Again, for mobile users in particular, security concerns dictate the use of encryption.

Summary

A decades-long technology, FAT remains in use today. Here’s a quick comparison of the different versions of FAT.

 

FAT12

FAT16

FAT32

Addressing

12 bits

16 bits

32 bits, only 28 used

Date

1977 with release in 1980

1984 and 1987

1996

Maximum volume size

32 MB

2 GB (4 GB in some cases)

2 TB (124.55 GB in practice)

Maximum file size

32 MB

2 GB (4 GB in some cases)

4 GB

Max number of files / clusters

4,077

65,517

268,435,437