Getting the Boot:FAT File System

From OS2World.Com Wiki
Jump to navigation Jump to search

By Howard Gilbert

Return to Getting the Boot

  • Supported by all operating systems
  • Minimal memory use
  • Simple and reliable
  • NAME.EXT file names
  • Less efficient on partitions above 32 meg
  • Not suitable for File Servers

The File Allocation Table (FAT) was designed and coded in Feb., 1976 by a kid named Bill Gates during a five day stay at the Hilton Hotel in Albuquerque. He developed it for a version of Basic that could store programs and data on floppy disks. The FAT design was incorporated by Tim Patterson in an early version of an operating system for the Intel 8086 chip. Gates bought the rights to the system, then rewrote it to create the first version of DOS. As a direct result, Gates is the richest man in America.

The FAT file system is simple and reliable. It does not lose data because the computer crashed in the middle of an update. It does not use a lot of memory. It does, however, do a lot of extra administrative I/O to different areas of the partition. The directory is allocated at the start of the partition and it contains the table of freespace. To write a new dataset, or to add data to an old one, the disk arm must be constantly moved between the location of the directory and the place where the data is being written. Without optimization, a file can end up fragmented into many small pieces.

When the system crashes, no data is lost. However, a FAT system may have removed disk area from the chain of free space, but may not yet have assigned it to any permanent new dataset. The CHKDSK (or on newer systems the SCANDISK) utility examines the FAT table to determine the status of every record on disk. The records which are not part of any dataset may be returned to the free space chain.

After CHKDSK finds unallocated sectors, it asks you whether they should be turned into files. If you were in the middle of creating a new file and the system crashed, and the data that was lost is extremely valuable, you might answer Yes. Then you can scan the recovered file scraps for the information you lost. Otherwise, answer No and the unallocated space will be recycled as freespace.

By design FAT supports a maximum of 64K allocation units. When the disk partition is 32 megabytes or less, then an allocation unit is a 512 byte sector. However, as the disk gets larger, the units get larger. A 64 megabyte disk partition has 1K allocation units. A 128 meg partition has 2K units. A 256 meg partition has 4K allocation units. Each file occupies one or more allocation unit. As the allocation units get large, any large number of small files wastes a lot of disk space.

The classical FAT directory structure (before NT and Windows 95) limits file names to eight characters with a three character extension (as in the name "AUTOEXEC.BAT"). This 8.3 naming convention was borrowed from earlier DEC minicomputers. The FAT structure also maintains for each file a set of attributes (is it a System dataset, should it be Hidden in the DIR display, should it be Archived next time the disk is backed up, is it Read-only). There is also a data and time stamp when the file was last changed.

OS/2 allows a FAT file to have additional Extended Attributes. Since there is no room for these attributes in the FAT directory, OS/2 creates a separate hidden file on the disk volume named "EA DATA. SF" and stores the information there.

FAT has been around for a long time, so its problems have been carefully studied. Every version of DOS comes with a DEFRAG program that will reorganize the directory, files, and freespace to maximize performance. Effective use of RAM as a disk cache can address some of the I/O problems.

Return to Getting the Boot