How does testdisk read sectors?

How to use TestDisk to recover lost partition
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
Post Reply
Message
Author
doccpu
Posts: 4
Joined: 10 Sep 2021, 02:01

How does testdisk read sectors?

#1 Post by doccpu »

I was wondering how testdisk and also it appears dd reads sectors. The time out time is minutes long. Does it use bios calls or a call via linux kernel calls or what to read a sector from disk? the time out is outrageous. Is there any way to attempt to read a sector with maybe 3 trys then go one if it cant. in an hour dd only tried to read about 100 sectors on a fast machine running debian 11.

recuperation
Posts: 1710
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: How does testdisk read sectors?

#2 Post by recuperation »

Testdisk or Photorec should rather be used on a disk without unreadable sectors.

When dealing with disks with broken sectors the best solution is to duplicate the disk using ddrescue.
The only exception not to duplicate is a case where you are only interested in recovering a part of the data inside and fearing that the copy process may further deteriorate the state of the disk so much that your data gets destroyed by the copy process.

Use ddrescue instead of dd as ddrescue comes with an option to bypass the kernel:

https://www.gnu.org/software/ddrescue/m ... anual.html

Limiting the number of retry operations of a disk when reading a sector is possible in some cases. It depends on the manufacturer and model.
Western Digital for instance calls this feature "time limited error recovery". Some disks that are supposed to be compatible to work in RAID arrays might come with this feature being already enabled.

Please check with your manufacturer.

Post Reply