cgsecurity / testdisk

TestDisk & PhotoRec
https://www.cgsecurity.org/
GNU General Public License v2.0
1.61k stars 197 forks source link

Testdisk recovers same files again and again in linux #143

Open estatistics opened 1 year ago

estatistics commented 1 year ago

I have a faulty disk (ext4 linux). I started testdisk. It analyzes the hdd disk and founds something like that structure

Folders: "a" (with red color) "copy a" (with red color) "a" (with green color) "copy a" (with green color)

I found out that some files may exists in specific folders but not all. However, testdisk recovers same files again and again. In ext4 files/folders I think they are attached with hard links. I think that testdisk, at least in ext4 format, it must have an option to not recover duplicated files eg. based on name/folder structure and size.

Also, it will be nice to provide to extract the directory tree only without data and given that directory txt, to be able to provide testdisk with specific folders to recover eg. testdisk --recover folders.txt

TestDisk 7.1, Data Recovery Utility, July 2019 in linux debian.

cgsecurity commented 12 months ago

Hardlinks are not valid for directories. Do you have the problem with copying both deleted and not deleted-files ? 'h' can use to hide deleted files.

estatistics commented 12 months ago

I may not stated clearly my problem and enhancements

DIR A has files aa,ab,ac, DIR B has files ba bb bc DIR C has files ca cb cc. Because directory structure has been faulty, some infinitive circulation becomes. eg. ac becomes ac.DIR which contains DIR.B and DIR.A.

So recovering DIRA leads to recover DIRB and DIRA, and then again to recover DIRA which contains BIRB and DIRA. This has happen 2 times and testdisk is infinitively recover only these data again and again. DIR.C is never recovered and recovery for about a month didnt stop to recover in my computer! Speed it was very low due to disk problems. Must be recovered same folders over 4 times again and again. My HDD had about ~3tb of data but recovered only ~1TB again and again for about 1 month!

1) TESTDISK may output the current folder/file for recovery. 2) TESTDISK may provide an option to explicity extract only the directory tree without file recovery 3) TESTDISK may be able using dir_to_recover.txt, to recover specific files. 4) TESTDISK must be able to keep a tree log. and the points that it is corrupted and leads to recovery circles, it must be able to break / skip same directory for recover if it has been already recovered.

Same - folder repetition - problem for SSD disk was also found when i had power brakes.

cgsecurity commented 11 months ago

If disk contains bad sectors, you should clone the disk to a new empty disk using ddrescue as described in https://www.cgsecurity.org/testdisk_doc/ddrescue.html and run testdisk against the clone

If you tried latest 7.2-WIP version, do you have the same problem ?