Testdisk.log dump of Corrupt Drive

Everything else that doesn't fall into one of the other PB categories.
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Testdisk.log dump of Corrupt Drive

Post by oldefoxx »

I was criticized before for posting this topic in the coding section. My reason for doing so the first time was that I need to know how to overwrite the contents of specific sectors on several drives that are corrupting the contents of partitions and the partition table itself.

People either did not believe me, or thought the problem was unique to my version of Linux. I thought that was a possability myself at one point, but I can't be sure.

To show you the problem in depth, I am posting 3 files. One is the log file which is named testdisk.log. The second file produced was a temporsry one that kept just one copy of every unique line in the log except for blank lines. It left those in play. That is td2.txt.

The 3rd file is td1.txt. It is a product of testdisk.log and td2.txt where an added column appears before every line showing you how frequently that same identical line appears scattered throughout testdisk.log. The most common is blank lines. Many of the remainder are apparently orphaned superblocks that are scattered over the drive surface.

Note the errors reported in all three files. This drive is corrupt. and what it proposes be done to fix the problem doesn't seem to go to the heart of the matter.

This is just one drive. I have 5 more with similar issues. So if someone knows of a method to overwrite specific sectors with new data, that could be a big help going forward.

Oh, if you are into bash programming and want to know how I got unique lines without using sort -u, which would change the order of the lines, it turned out to be simple. Just use grep -c and only write those lines not found in a second file as appends to that second file. You only do this if grep -c returns a "0". I also checked for blank lines and passed them through as appends to the second file as w ell. This is going from td2.txt to td1. I later thought how easy it would have been to use grep -c to go from testdisk.log straight to td1.txt, but I wanted td2.txt as well, so no harm done.

Code: Select all

 > td1.txt; while read a; do [ "$a" = "" ] && echo >> td1; [ "$a" != "" ] && b=$(grep -c "$a" testdisk.log) && echo -e "$b\t$a" | tee -a td1.txt; done < td2.txt
Note that the entanglement of partitions include FAT and NTFS partitions, and that superblocks are not specific to Linux as one poster suggested.

This is the link https://my.pcloud.com/publink/show?code ... dreF9SlxWX for downloading the one compressed file that I stored at my free Cloud account online.
has-been wanna-be (You may not agree with what I say, but it will make you think).