MS-DOS 6.22 FAT16 File Allocation Explained

MS-DOS 6.22 manages storage drives using the 16-bit File Allocation Table (FAT16) file system, which organizes disk space into logical clusters and tracks file data through linked allocation chains. This article explains how the operating system navigates FAT16 disk structures, enforces cluster addressing limits, handles 8.3 directory entries, and ensures data integrity through redundant allocation tables.

FAT16 Disk Layout

When MS-DOS 6.22 accesses a FAT16 partition, it expects a strictly defined sequential layout on the storage medium:

  1. Volume Boot Record (VBR): Located at the first sector of the partition, the VBR contains the BIOS Parameter Block (BPB). The BPB defines critical geometry data, including sector size (typically 512 bytes), sectors per cluster, the number of reserved sectors, the number of FAT copies, and the total sector count.
  2. File Allocation Tables (FAT 1 & FAT 2): Immediately following the reserved sectors, DOS maintains two identical copies of the allocation table. FAT 1 is the active mapping table, while FAT 2 serves as a real-time duplicate to protect against data corruption.
  3. Root Directory Table: A fixed-size region located immediately after FAT 2. In FAT16, this directory is fixed at 512 entries on hard drives, limiting the root directory to 512 files or folders.
  4. Data Area: The remainder of the partition, divided into uniform blocks called clusters. File contents and subdirectories are stored exclusively in this area.

Cluster Addressing and Partition Limits

FAT16 uses 16-bit integers to identify individual clusters in the data area. This limits the total addressable cluster count to \(2^{16}\) (65,536), with specific values reserved for system operations, leaving 65,524 addressable clusters for user data.

MS-DOS 6.22 supports sector pooling to scale cluster sizes based on the partition size:

  • Partitions up to 128 MB: 2 KB clusters (4 sectors per cluster)
  • Partitions up to 256 MB: 4 KB clusters (8 sectors per cluster)
  • Partitions up to 512 MB: 8 KB clusters (16 sectors per cluster)
  • Partitions up to 1,024 MB (1 GB): 16 KB clusters (32 sectors per cluster)
  • Partitions up to 2,048 MB (2 GB): 32 KB clusters (64 sectors per cluster)

Because 32 KB (64 sectors \(\times\) 512 bytes) is the largest cluster size natively supported by MS-DOS 6.22 for standard FAT16 volumes, the operating system imposes a hard ceiling of 2,048 MB (2 GB) per drive letter. Larger physical hard drives must be split into multiple primary partitions or logical drives within an extended partition (e.g., C:, D:, E:).

File Directory Entries and 8.3 Naming

MS-DOS 6.22 relies entirely on the 8.3 filename specification. Every file or folder in a directory table consumes a 32-byte record containing:

  • Filename and Extension: 8 bytes for the name, 3 bytes for the extension (ASCII format, capitalized).
  • Attributes: 1 byte flagging properties such as Read-Only, Hidden, System, Volume Label, Directory, or Archive.
  • Timestamp: 4 bytes detailing the creation/modification time and date.
  • Starting Cluster Pointer: A 2-byte (16-bit) value indicating the first cluster in the data area where the file's data begins.
  • File Size: A 4-byte integer recording the exact size of the file in bytes.

Cluster Chaining and File Reading

To read a file, MS-DOS 6.22 performs a sequential lookup:

  1. It searches the directory table for the requested filename and reads its starting cluster index.
  2. It accesses the FAT in memory to find the corresponding entry for that cluster index.
  3. The value inside that entry points to the next cluster index containing the subsequent portion of the file.
  4. The system continues reading cluster by cluster, following this linked list (known as a "cluster chain").
  5. The read process terminates when the operating system encounters an End-of-Cluster-Chain marker (values from 0xFFF8 to 0xFFFF).

Special values in the FAT16 table include:

  • 0x0000: Free, unallocated cluster.
  • 0x0002 to 0xFFEF: Valid cluster pointers pointing to the next cluster in a chain.
  • 0xFFF7: Bad cluster marker (flagged by FORMAT or SCANDISK to prevent allocation).
  • 0xFFF8 to 0xFFFF: End-of-file (EOF) marker.

Write Operations and Redundancy

When saving new data or extending existing files, MS-DOS 6.22 scans the FAT for entries marked 0x0000. It assigns the first available cluster to the file, writes the data to the corresponding physical sector on disk, updates the previous cluster pointer to point to the newly assigned cluster, and flags the final cluster with an EOF marker.

To maintain integrity, MS-DOS 6.22 writes updates to FAT 1 first, followed immediately by an identical write to FAT 2. Disk caching utilities like SMARTDRV.EXE and the BUFFERS command in CONFIG.SYS hold FAT sectors in RAM to minimize the mechanical latency associated with constant disk head repositioning between the directory tables, the FATs, and the data area.