Microsoft Fdisk

When run, Microsoft FDISK destroys some data on your drive. While "checking disk integrity", FDISK writes hexadecimal F6h into the first and 7th sectors on each track. If you have accidentally deleted a volume, do not run any Microsoft FDISK program! More info here

How do DOS versions of TestDisk get disk geometry ?

The DOS version of TestDisk uses three BIOS calls to get a disk's geometry. It gets the number of cylinders, heads and sectors (CHS) from function 8/int 0x13, but this function is limited to small hard disks (the maximum values are 1024 cylinders, 255 heads, 63 sectors: 8.4 GB at best). If enhanced BIOS disk calls are available (check by calling function 0x41/int 0x13), it gets the disk size from function 0x48/int 0x13 and calculates the number of cylinders.

How is the Partition Table written ?

CHS (Cylinder, Head, Sector) values are limited by a set number of bits for each value in the 16-byte partition table entries to: 1023,254,63. There are two ways to store the CHS value:

It's what Partition Magic does (prior to version 8.0?).

This is what Linux fdisk and TestDisk do.

When TestDisk checks the partition table, it considers both ways may be correct. But the second way is better because start CHS is always lower or equal to end CHS.

Example: A hard disk's logical geometry is 255 heads per cylinder and 63 sectors per head. A partition begins at LBA=46781280 or CHS=2912,0,1. This partition ends at 3072,254,63.

NB: 1023 = 0x3FF (1023*255+254)*63+63-1=16450559 (2912*255+ 0)*63+ 1-1=46781280

Partition Magic (before version 8.0?) considered the second way as invalid; even though it's an agreed upon standard. TestDisk handles both without complaining.

Return to TestDisk main page