File Systems |
The FAT file system has the file allocation table located at the beginning of a logical volume. FAT was designed for small disks and simple folder structures. Two copies of the file allocation table are stored on the volume. In the event that one copy of the file allocation table is corrupted, the other file allocation table is used.
FAT16 is included in Windows 2000 for the following reasons:
For Windows 2000 and Windows NT, the maximum size for a FAT16 volume is 4,095 megabytes (MB).
A volume formatted with FAT16 is allocated in clusters. The default cluster size is determined by the volume size, and can be as large as 64 kilobytes (KB). The cluster size must be a power of 2 between 512 and 65,536 bytes. Table 3.2 shows the default cluster sizes for FAT16 volumes. You can specify a different cluster size if you format the volume with the format command from the command prompt. However, the size you specify must be listed in Table 3.2.
Table 3.2 FAT16 Cluster Sizes
Volume Size | Sectors Per Cluster | Cluster Size |
---|---|---|
0 MB–32 MB | 1 | 512 bytes |
33 MB–64 MB | 2 | 1 KB |
65 MB–128 MB | 4 | 2 KB |
129 MB–255 MB | 8 | 4 KB |
256 MB–511 MB | 16 | 8 KB |
512 MB–1,023 MB | 32 | 16 KB |
1,024 MB–2,047 MB | 64 | 32 KB |
2,048 MB–4,095 MB | 128 | 64 KB |
FAT16 is not recommended for volumes larger than 511 MB because, when relatively small files are placed on a FAT16 volume, FAT uses disk space inefficiently. You cannot use FAT16 on volumes larger than 4 gigabytes (GB), regardless of the cluster size.
Note
On volumes with fewer than 32,680 sectors, the cluster sizes can be up to 8 sectors per cluster. The format program, whether you format the volume using Disk Management or by typing format at the command prompt, creates a 12-bit FAT. Volumes less than 16 MB are usually formatted for a 12-bit FAT, but the exact size depends on the disk geometry. The disk geometry also determines the point at which a larger cluster size is needed because the number of clusters on the volume must fit into 16 bits. Therefore, you might have a 33-MB volume that still has only 1 sector per cluster.
FAT12 is the original implementation of FAT and is intended for very small media. The file allocation table for FAT12 is smaller than the file allocation table for FAT16 and FAT32, because it uses less space for each entry. This leaves more space for data. All 5.25-inch floppy disks are formatted with FAT12, and 1.44-MB 3.5-inch floppy disks are generally formatted with FAT12. Volumes on Iomega Zip and Jaz drives are formatted with FAT16.
Figure 3.1 illustrates how FAT maps out clusters on a volume. The file allocation table (areas FAT1 and FAT2 in Figure 3.1) identifies each cluster in the volume as one of the following:
Figure 3.1 Organization of a FAT Volume
The only difference between the root folder and other folders is that the root folder is at a specified location and has a fixed number of entries (for a hard disk). The number of entries on a floppy disk depends on the size of the disk.
Note
Each folder and file in the root folder uses one or more entries. For example, if the fixed number of entries is 512 and you have 100 folders, you can only create 412 files.
Folders have a 32-byte entry for each file and folder contained in the folder. Assuming short file names are used, the entry includes the following information:
In a FAT folder structure, files are given the first available location on the volume. The starting cluster number is the address of the first cluster used by the file. Each cluster contains a pointer to the next cluster in the file, or an end-of-file (EOF) indicator at (0xFFFF) which indicates that this cluster is the end of the file. These pointers and end-of-file indicators are shown in Figure 3.2.
Figure 3.2 Files on a FAT Volume
Figure 3.2 shows three files in a folder. File1.txt is large enough to use three clusters. File2.txt is a fragmented file that also requires three clusters. The third file, File3.txt, fits completely in one cluster. In each case, the folder entry points to the first cluster of the file.
The information in the folder is used by all operating systems that support FAT. Windows 2000 can store additional time stamps in a FAT folder entry. These time stamps show when the file was created or last accessed.
Because all entries in a directory are the same size, the attribute byte for each entry in a directory describes what kind of entry it is. For example, one bit indicates that the entry is for a subdirectory and another bit marks the entry as a volume. Typically, only the operating system controls the settings of these bits.
The attribute byte includes four bits that can be turned on or off by the user — archive, system, hidden, and read-only.
Support for FAT32 is new in Windows 2000. FAT16 supports volumes up to 4 GB, whereas theoretically FAT32 can manage volumes up to 2 terabytes. The FAT32 on-disk format and features on Windows 2000 are similar to those on Windows 95 OSR2 and Windows 98.
The size of a FAT32 cluster can range in size from 1 sector (512 bytes) to 64 sectors (32 KB), incremented in powers of 2.
Since FAT32 requires 4 bytes to store cluster values, many internal and on-disk data structures have been revised or expanded. Most programs are unaffected by these changes; however, disk utilities which read the on-disk format must be updated to support FAT32.
Two application programming interfaces (APIs) are disabled on FAT32. Since the BIOS parameter block (BPB) structure grows from 25 bytes on FAT16 to 53 bytes on FAT32, and FSCTL_QUERY_FAT_BPB is defined to return only as much of the boot sector as contains the 25 byte form of the BPB, it is disabled on FAT32. To retrieve the BPB on FAT32, applications should read the volume directly. This also works for FAT16. Extended attributes are disabled on FAT32 since increasing the cluster number to 4 bytes requires the use of the field previously used to index the extended attribute database.
The main difference between FAT16 and FAT32 is the logical partition size. FAT32 breaks the 2-GB logical drive limitation of FAT16 volumes by extending a single logical drive capacity to at least 127 GB. If you have a 2-GB FAT16 drive, you must use a 32-KB cluster. With FAT32, the range for a 4-KB cluster, for example, includes drive sizes between 512 MB and 8 GB.
The largest possible file for a FAT32 drive is 4 GB minus 2 bytes. FAT32 uses 4 bytes per cluster within the file allocation table. This differs from FAT16, which uses 2 bytes per cluster within the file allocation table. Table 3.3 shows the default cluster sizes for FAT32.
Table 3.3 FAT32 Cluster Sizes
Partition Size | Default Cluster Size |
---|---|
Less than 8 GB | 4 K |
Greater than or equal to 8 GB, and less than 16 GB | 8 K |
Greater than or equal to 16 GB, and less than 32 GB | 16 K |
Greater than or equal to 32 GB | 32 K |
A FAT32 volume must have at least 65,527 clusters. Also, the cluster size on a FAT32 volume cannot be such that the file allocation table is greater than (16 MB – 64 KB)/4, or almost 4 million clusters.
FAT16 and FAT32 do not scale well. As the volume gets bigger, the file allocation table gets bigger, which dramatically increases the amount of time it takes Windows 2000 to compute how much free space is on the boot volume when the system is restarted.
For this reason, you may not create a FAT32 volume larger than 32 GB using the Format utility. However, the Windows 2000 Fastfat driver enables you to mount and fully support a FAT32 volume larger than 32 GB.
Use NTFS to format volumes larger than these. For more information about why you should format all Windows 2000 partitions with NTFS, see "Advantages of NTFS" later in this chapter.
Files created or renamed on FAT volumes use attribute bits to support long file names in a way that does not interfere with how
Whenever you create a file with a long file name, Windows 2000 creates a conventional 8.3 name for the file and one or more secondary folder entries for the file, one for each 13 characters in the long file name. Each secondary folder entry stores a corresponding part of the long file name in Unicode.
Windows 2000 marks the secondary folder entries as part of a long file name by setting the volume ID, read-only, system, and hidden attribute bits.
Figure 3.3 shows all of the folder entries for the file Thequi~1.fox, which has a long name of The quick brown.fox. The long name is in Unicode, so each character in the name uses 2 bytes in the folder entry. The attribute field for the long-name entries has the value 0x0F. The attribute field for the short name has the value 0x20.
Figure 3.3 Long File Name on a FAT Volume
Note
Windows NT and Windows 2000 do not use the same algorithm to create long and short file names as Windows 95 and Windows 98. However, on computers that multiple-boot these operating systems, files that you create when running one operating system can be accessed when running the other.
For information about how Windows 2000 creates short file names, see "Using Long File Names" later in this chapter.
By default, Windows 2000 supports long file names on FAT volumes. You can prevent a FAT file system from creating long file names by setting the value of the Win31FileSystem registry entry (in HKEY_LOCAL_MACHINE\System
\CurrentControlSet\Control\FileSystem\Win31FileSystem) to 1.
Caution
Do not use a registry editor to edit the registry directly unless you have no alternative. The registry editors bypass the standard safeguards provided by administrative tools. These safeguards prevent you from entering conflicting settings or settings that are likely to degrade performance or damage your system. Editing the registry directly can have serious, unexpected consequences that can prevent the system from starting and require that you reinstall Windows 2000. To configure or customize Windows 2000, use the programs in Control Panel or Microsoft Management Console (MMC) whenever possible.
This value prevents Windows 2000 from creating new long file names on all FAT volumes, but it does not affect existing long file names.
FAT16 works the same way in Windows 2000 as it does in
Note
You cannot use Windows 2000 with any compression or partitioning software that requires disk drivers to be loaded by