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

Using TestDisk to undelete files
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
mesajflaviu
Posts: 37
Joined: 12 Sep 2019, 19:54

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

#1 Post 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 ?

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

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

#2 Post 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.

mesajflaviu
Posts: 37
Joined: 12 Sep 2019, 19:54

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

#3 Post by mesajflaviu »

Understood. Kindly thank you.

Locked