I found a critical FDISK error leading to a wiped disk. The error is luckily not commonly triggered. I found it because after Pauls mail I tested how FDISK handles the case of maximum logical partitions. Turned out not that great...
FDISK can handle a maximum of 23 logical partitions per disk. FDISK auto partitioning creates 22 at max, so this is not affected out of the box. The error occurred if there were the maximum number (23) of logical partitions defined for a disk, and then a logical other than the first was deleted. FDISK would then write a zeroed-out EMBR to sector 0, effectively wiping the MBR. Cause was a missing not-used flag for the very last (and zeroed) EMBR in the chain. This is the line to blame: https://github.com/FDOS/fdisk/blob/d795693140c068a2c07176889f7d8fdddb571907/source/fdisk/pdiskio.c#L837 That must be -2, not a -1. I will prepare a new release for this and include it for FreeDOS RC2. Affected versions: at least all that I released (>=1.3.5). Have not tested with earlier versions yet. Looking at the 1.3.1 source, they could also be affected (next_ext_exists[drv] is not set explicitly to false for the last drive). https://github.com/FDOS/fdisk/blob/ef0bda745873c5339a35dd0c0c5e1899fb2cbc3e/SOURCE/FDISK/PCOMPUTE.C#L546-L639 Bernd _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel