An Introduction To FAT 16/FAT 32 File Systems
An Introduction To FAT 16/FAT 32 File Systems
Introduction
This paper is written to introduce the casual PC or digital camera user to the topic of File Allocation Tables, commonly known as FAT. This paper will focus on the issues of FAT and how it relates to Compact Flash (CF) devices that generate large le sizes such as 5+ megapixel digital cameras. The reason that FAT is now important to CF users is that devices which require, or are optimized by using storage capacity greater than 2.14 Gigabytes (GB) require a different type of FAT than those that use fewer than 2.13GB. Not since the application of a hard disk into Personal Computers (c1983) has this topic been so important. The next section is written for those who are interested in the historical background relative to FAT. If that is not of interest to you, feel free to continue with the Clusters section. diskettes. This permitted 4096 possible values and if each entry referenced a single 512-byte sector then this FAT table could handle storage devices of up to 2 GB. However, this resulted in long tables that took time to retrieve and could not be kept in memory since memory sizes were usually less than 64 Kilobytes! So the concept of clusters was incorporated. This increased the minimum element of storage on a device from a single sector to a xed number of sectors, called a cluster. For those rst 180KB diskettes, the cluster size was 2 or 1024 bytes. Thus if one was saving a 500 byte le, it would occupy 1024 bytes on the diskette. This seems wasteful but in reality the cluster concept works great on larger les which most of the system and user les tend to be. Table 1 illustrates the maximum number of clusters that can be represented by a FAT.
FAT SIZE in bits
12 16 32
Table 1: Clusters per FAT
History
When the rst Personal Computers were developed, they used oppy disks with a capacity of 180 kilobytes, soon followed by double-sided diskettes of 360KB. These were the 5 1/4-inch diskettes that you probably noticed in your fathers PC! In order to organize data on these storage devices, the initial developers of DOS created tables to indicate which sectors belonged to which les and which sectors were vacant. This allowed the Operating System (DOS) to make maximum use of the limited space on these diskettes. Files could be saved without having a contiguous series of sectors available. The data for the les could be broken up and scattered all over the diskette in an organized manner that is now called fragmentation. However, at that time, it was nice to be able to store your data on the same diskette as the operating system so you didnt have to keep switching diskettes in and out during the operation of the program. On a 360KB diskette there are 768 sectors. Thus, the table had to be big enough to identify each of the 768 sectors and allow some room for growth since the developers knew that larger diskettes were coming. Using one byte per table entry only permitted 512 possible values so that would not do. Two bytes would permit 16384 entries and would be wasteful of disk space. So the decision was made to use 12 bits (1 1/2 bytes) as the length of the table entries to keep track of sector usage on these rst
WHITE PAPER
Number of Clusters
4096 65536 4,294,967 ,296
Clusters
The smallest element of addressable storage on a disk is called a sector and usually holds 512 bytes (or characters). Since most les are much larger than a sector, an even larger amount of storage should be the smallest amount allocated to any particular le. This allocated amount is called a cluster and depending on the capacity of the storage device (diskette, ash card, hard drive) the size of the cluster will vary to get optimum use of the device. On the early 360KB diskettes, the cluster size was 2 sectors (1024 bytes). Using the rst 10MB hard disk, the cluster size was increased to 8 sectors (4096 bytes). Typical cluster sizes for compact ash devices today are 8K (8192 bytes) or 16K (16384 bytes). Hard disks up to 2 Gigabytes have a cluster size of 32K. Table 2 illustrates the maximum size of a partition given a cluster size and a FAT type.
www.hitachiGST.com
FAT Examples
An empty 16 bit FAT
0 0000
1 0000
2 0000
3 0000
4 0000
5 0000
6 0000
7 0000
8 0000
0001
0002
0006
0000
0000
0000
0007
FFFF
0000
This FAT illustrates that the first cluster is number 0, the second is number 1, the third is number 2, the fourth is number 6, and the last is number 7.
This FAT has 2 files. One has 3 clusters (0, 1, 8) and the other 2 clusters (2, 6).
0 0001
1 0008
2 0006
3 0000
4 0000
5 0000
6 FFFF
7 0000
8 FFFF
Cluster 0
In reality, the rst cluster (cluster 0) is always reserved for operating system information, the root directory and two copies of the FAT. The system creates two copies of the FAT so that should the system be interrupted (crash) while modifying one of the copies, the other copy is still intact and a recovery program may check the FAT and recover it using the copy.
Big Deal?
So what is the big deal about FAT? Up to now, the Compact Flash storage devices have used either a 12-bit or 16-bit FAT. Digital cameras and digital music players have been designed to read and write using this table structure. Since the introduction of the 4GB Microdrive in 2003, 16-bit FAT is not large enough to handle all the sectors. With 16 bits, only 65536 clusters can be represented and with the maximum cluster size of 32K bytes, only 2.14 GB can be accommodated in a single FAT. There are two solutions. Increase the FAT size to 32 bits or split the drive into multiple partitions.
www.hitachiGST.com
default to a FAT32 format unless specically selected. When doing this for the rst time, watch the prompts carefully to insure you will keep your FAT16 format unless your camera/PDA/digital music player supports FAT32. Using a FAT32 device in a FAT16 compatible host will result in several possible outcomes. The most common is that the ubiquitous CF ERROR appears in the display. Should a 4GB or larger capacity device be formatted in a FAT16 only compatible host, the drive formats without error but should indicate a 2GB capacity. Note the word should. Different programmers can use different methods to handle this issue and for this unusual case, the result is not always predictable. If a 4GB device ever is formatted with FAT16, one can re-format the device in a FAT32 compliant host, as long as the FAT32 is specied during the format session. This will enable the user to regain the full capacity in a FAT32 compliant host.
Summary
Since cameras and digital music players have difculty with multiple partitions, FAT 32 is the only answer to provide them with storage in excess of 2.14GB. Therefore the new Hitachi 6GB and greater capacity Microdrives will be shipped pre-formatted for FAT 32. To provide for compatibility with more devices, the 2GB Microdrive will continue to use FAT 16. Other Compact Flash devices must jump on the FAT 32 bandwagon as their capacities exceed the 2GB barrier. The good news is that several companies are already supporting FAT 32 in their cameras and digital music players. Most PDAs that have a CF slot support FAT 32 today. If you are planning to purchase a new digital camera or digital music player it would be a good idea to verify that it does support FAT 32 for future compatibility with the latest CF storage devices.
Figure 1
FAT Inter-compatibility
Using a FAT16 storage device in a host compatible with FAT32 will operate seamlessly because operating systems that support FAT32 will also support FAT16. The only caution is when you want to re-format the FAT16 device. Some FAT32 compatible hosts (e.g. some PDAs) will
Hitachi Global Storage Technologies trademarks are intended and authorized for use only in countries and jurisdictions in which Hitachi Global Storage Technologies has obtained the rights to use, market and advertise the brand. The Travelstar trademark is authorized for use in the Americas, EMEA, and the following Asia-Pacic countries and jurisdictions: Australia, Hong Kong, Japan, New Zealand, South Korea and Taiwan. Contact Hitachi Global Storage Technologies for additional information. Hitachi Global Storage Technologies shall not be liable to third parties for unauthorized use of this document or unauthorized use of its trademarks. References in this publication to Hitachi Global Storage Technologies products, programs or services do not imply that Hitachi Global Storage Technologies intends to make these available in all countries in which it operates. Product specications provided are sample specications and do not constitute a warranty. Information is true as of the date of publication and is subject to change. Actual specications for unique part numbers may vary. Please visit the Support section of our website, www.hitachigst.com/support, for additional information on product specications. Photographs may show design models.
2007 Hitachi Global Storage Technologies Hitachi Global Storage Technologies 3403 Yerba Buena Road San Jose, CA 95135 USA Produced in the United States 11/07. All rights reserved. Microdrive is a registered trademark of Hitachi Global Storage Technologies.