Skip to main content
7 of 8
added 122 characters in body
user3840170
  • 25.5k
  • 4
  • 101
  • 162

If you can manage to boot the computer from a DOS floppy or some other device, you should be able to use the classic partitioning tool, Ranish Partition Manager. (I recommend version 2.40 or 2.44; neither unfortunately comes with source code, but they are considerably more flexible than 2.37, which does.) When you start the program, you will be presented with an interactive low-level(-ish) editor of the Master Boot Record, with the disk’s logical geometry (the one used with interrupt 0x13 services) displayed at the top. Any discrepancies the program detects will be highlighted in red.

Screenshot of RPM 2.40

You may remember that the MBR defines partition boundaries using both CHS and LBA coordinates. As it happens, Ranish Partition Manager prefers using the LBA fields, and derives CHS coordinates from those. This means that, assuming the LBA fields are correctly filled, all you need to do to adjust the MBR for the new geometry is start RPM, immediately press F2 to write the MBR to disk, and exit. RPM will re-calculate the CHS coordinates from the LBA offsets stored in the partition table and the geometry it received from the BIOS.

If the disk contains FAT partitions you want to be able to boot from, you will additionally need to fix the geometry found within the boot sector’s BIOS Parameter Block. With RPM, this is also easy: select the partition entry and press ↵ Return to enter the BPB editor. As before, immediately press F2, then Esc to go back to the partition list. RPM will write the new geometry information into that partition’s BPB.

NTFS partitions also store the disk geometry in a very similar structure, but RPM is not able to correct it as easily. What you may try doing is: press Insert to temporarily change partition type to FAT (e.g. 0x06), then ↵ Return to enter the BPB editor, then as before, without changing anything, immediately save the BPB with F2, exit the BPB editor with Esc and change the partition type back to NTFS (0x07). This works because the layout of NTFS’s BPB is largely the same as FAT’s; at least its initial fields, which contain the geometry information. In my quick experiment in a VM, nothing other than the geometry fields was modified in the boot sector, so I expect it to be relatively safe. But if you want to be absolutely sure, you can use a hex editor instead.

Extended partitions (type 0x05) may pose more problems. The main difficulty with them is that MS‑DOS expects Extended Boot Records to be aligned on a cylinder boundary. If the EBR is not so aligned under the new geometry, MS‑DOS will not be able to access the logical drives correctly. The simplest way to address this, if you don’t mind the fact that it will make the logical drives unreadable under an OS older than MS‑DOS 7.0 (the one bundled with Windows 9x; equivalently, a clone like FreeDOS that happens to support the same feature), is to change the EBR’s partition type from 0x05 (‘Extended’ in RPM) to 0x0f (confusingly labelled ‘VFAT Extended LBA’, despite not having anything to do with FAT). Other than that, you might not be able to access the disk without re-partitioning it entirely.

user3840170
  • 25.5k
  • 4
  • 101
  • 162