MS-DOS 6.22 Bad Sector Allocation During Format

During the disk formatting process, MS-DOS 6.22 identifies physically defective storage media areas and isolates them to prevent data loss. Rather than repairing physical media or managing individual sectors at the file system level, the operating system identifies defective sectors through read/write verification and flags the entire parent cluster as unusable directly within the File Allocation Table (FAT). This mechanism ensures that the operating system permanently bypasses those areas during subsequent file allocation routines.

The Format Verification Process

When running the FORMAT command in MS-DOS 6.22, the utility performs a surface analysis of the data area on the target disk. It sequentially tests sectors by issuing BIOS-level disk interrupts (typically INT 13h) to read, write, and verify data.

If the controller returns an error—such as a Cyclic Redundancy Check (CRC) failure, a missing address mark, or a read fault—FORMAT notes the location of the offending sector.

Cluster-Level Flagging

MS-DOS 6.22 manages file storage using clusters (allocation units), which consist of groups of contiguous 512-byte sectors (ranging from 1 to 64 sectors per cluster depending on partition size).

Because the FAT architecture allocates space strictly by clusters rather than individual sectors, the operating system cannot isolate a single isolated bad sector. If even one 512-byte sector within a cluster fails the format verification test, the entire cluster containing that sector is designated as defective.

FAT Value Assignment

Once bad clusters are identified, MS-DOS 6.22 marks them by writing a specific reserved hexadecimal value into the corresponding entry in the File Allocation Table:

  • FAT12 (Floppy disks and small partitions under 16 MB): The entry is marked with 0xFF7.
  • FAT16 (Hard drive partitions up to 2 GB): The entry is marked with 0xFFF7.

These entries are written to both primary and secondary copies of the FAT (FAT1 and FAT2).

File Allocation Exclusion

When MS-DOS 6.22 subsequently allocates space for creating or extending files, it searches the FAT for available clusters marked as free (0x000 in FAT12 or 0x0000 in FAT16).

When the file system driver encounters 0xFF7 or 0xFFF7, it treats the entry as a reserved system marker. The allocation chain skips over this address entirely, ensuring that user data is never written to the compromised physical sectors.

Critical Area Restrictions

This bad-sector isolation strategy applies only to the data area of the disk. MS-DOS 6.22 cannot mark bad sectors within critical system areas, which include:

  • The Master Boot Record (MBR) and Partition Boot Sector
  • File Allocation Tables (FAT1 and FAT2)
  • The Root Directory table (on FAT12/FAT16 drives)

If FORMAT encounters an unreadable sector within any of these critical structures, it cannot allocate around the fault and terminates with an error, declaring the disk unusable.

Formatting Summary Report

At the completion of the format process, MS-DOS 6.22 displays a status report. If defective areas were discovered, it displays the total capacity rendered unusable in the line:

xxxx bytes in bad sectors

This byte count always represents the total number of bad clusters multiplied by the cluster size, rather than the raw count of individual defective sectors.