MS-DOS 6.22 FDISK /MBR: Repairing the Boot Record

The FDISK /MBR command in MS-DOS 6.22 is an undocumented utility switch designed to repair or restore the Master Boot Record (MBR) on a hard drive. It replaces corrupted or altered boot code on the drive's primary sector with a clean, default MS-DOS bootloader routine. This article explains how the command functions under the hood, what data it overwrites, what it leaves untouched, and the specific scenarios in which it should and should not be deployed.

How the Command Operates Internally

A standard Master Boot Record resides on Cylinder 0, Head 0, Sector 1 of a partitioned hard drive and spans exactly 512 bytes. The structure consists of three distinct segments:

  1. Bootstrap Code: The first 446 bytes containing executable machine code.
  2. Partition Table: The next 64 bytes detailing up to four primary partitions.
  3. Boot Signature: The final 2 bytes (0x55AA), marking the sector as bootable.

When executed, FDISK /MBR targets exclusively the first physical hard drive recognized by the system BIOS (interrupt INT 13h, drive 80h). The command reads the existing MBR into memory, extracts a clean 446-byte MS-DOS bootstrap loader embedded inside the FDISK.EXE executable, and writes this code over bytes 0 through 445 of the physical sector.

Preservation of the Partition Table

Crucially, FDISK /MBR does not repartition or format the hard disk. The 64-byte partition table (bytes 446–509) and the trailing boot signature (bytes 510–511) are left completely intact. This behavior allows the operating system to restore basic boot functionality without deleting user data or invalidating existing partition boundaries. If the drive already has an invalid or corrupted partition table, running this command will not repair it; it only restores the executable code responsible for locating and booting an active partition.

The MS-DOS 6.22 Boot Process After Repair

Once FDISK /MBR replaces the code, the updated boot sequence works as follows:

  1. The BIOS completes the Power-On Self-Test (POST) and loads the 512-byte MBR into memory at address 0000:7C00h.
  2. The restored MS-DOS bootstrap code executes and scans the partition table for an entry marked active (bootable flag 80h).
  3. If an active partition is found, the code reads that partition's Volume Boot Record (VBR) into memory and transfers control to it.
  4. If no active partition exists or more than one partition is marked active, the code halts the system and displays error messages such as "Invalid partition table" or "Missing operating system."

Primary Use Cases

  • Removing Boot Sector Viruses: In the MS-DOS era, boot sector viruses (such as Michelangelo or Stoned) often overwrote or hooked the MBR bootstrap routine. Executing FDISK /MBR from a clean, write-protected floppy disk purged the infected code.
  • Removing Third-Party Boot Loaders: Dual-boot environments utilizing alternative boot managers—such as OS/2 Boot Manager or early versions of LILO (Linux Loader)—could be neutralized to return the computer to a direct MS-DOS boot path.
  • Fixing Corrupted Boot Routines: Hardware glitches or abrupt shutdowns occasionally corrupted executable bytes in the first sector, preventing the BIOS from executing the chainload.

Risks and Limitations

While effective for standard hardware configurations, using FDISK /MBR carries risks in non-standard disk setups:

  • Drive Overlay Software: Older systems unable to natively address large hard drives often used Dynamic Drive Overlays (DDOs) such as EZ-Drive, Disk Manager, or Ontrack. These tools replaced the native MBR to intercept BIOS calls. Running FDISK /MBR destroyed this overlay, rendering all data on the disk inaccessible until the overlay was restored.
  • Single-Drive Target: FDISK /MBR in MS-DOS 6.22 does not accept parameters to target secondary hard drives (e.g., drive 81h). It can only write to the primary boot disk.