Page 1 of 1

How does testdisk read sectors?

Posted: 23 Oct 2021, 03:03
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.

Re: How does testdisk read sectors?

Posted: 23 Oct 2021, 10:02
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.