Page 1 of 1

Bad starting head (CHS and LBA don't match)

Posted: 15 Sep 2019, 19:34
by mesajflaviu
Trying to understand the undelete mechanism I am reading the testdisk source code. And I noticed something which I don't understand: In function i386_entry2partition, at point:

Code: Select all

	if (start.head >= disk_car->geom.heads_per_cylinder)
	{
		if (partition->errcode == BAD_NOERR)
			partition->errcode = BAD_SH;
	}
in this case start.head is 255 and disk_car->geom.heads_per_cylinder is 255 which lead to error from subject (Bad starting head (CHS and LBA don't match).

I have tested this code on 8GB USB stick formated as exFAT. However, when I run testdisk_win.exe on this USB stick, at "Analyse" option, I got

Code: Select all

Current partition structure:
     Partition                  Start        End    Size in sectors
                                                                                                                                  1 * HPFS - NTFS              0   1  1   983  36 13   15794113
                                                                                                                                 Bad sector count.
																															
this could be the cause for this error ? I doubt, because this stick is usable without any error ...

The fact is that static list_part_t* read_part_i386(disk_t* disk_car, const int verbose, const int saveheader) is not return me the list_part_t object correctly ...

Can you tell me what is going wrong here ?

Re: Bad starting head (CHS and LBA don't match)

Posted: 16 Sep 2019, 14:14
by cgrenier
If disk_car->geom.heads_per_cylinder is 255, start.head must be between 0 and 254.
The message is "Warning: Bad starting head (CHS and LBA don't match)", it's a warning, not an error.

Re: Bad starting head (CHS and LBA don't match)

Posted: 16 Sep 2019, 17:30
by mesajflaviu
Understood. Kindly thank you.