This is a discussion on How can I determine what vfat files own what blocks? within the Linux Administration forums, part of the Linux Forums category; Hi, I had a vfat partition develop some bad blocks. I used ddrecover to copy what was salvagable (i.e. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I had a vfat partition develop some bad blocks. I used ddrecover to copy what was salvagable (i.e. most of it - 29GB - 32KB) to another disk. It encountered 64 bad blocks, and since ddrecover reported the offsets (in kbytes) I assume that's easily mapped to block numbers (I'm assuming .5k is block 1, 500k is block 1000, etc). So I'd like to know which of the files I've "recovered" are actually corrupted because they contained one of the bad blocks, so that I can safely delete them. Does anybody know a good tool for doing this? Thanks, Bob |
|
|||
|
Oops - sorry, I meant ddrescue, not ddrecover...
bobdbitbucket@netscape.net (Bob) wrote in message news:<e6696cf0.0407050550.3a183167@posting.google. com>... > Hi, > > I had a vfat partition develop some bad blocks. I used ddrecover to copy what > was salvagable (i.e. most of it - 29GB - 32KB) to another disk. It > encountered 64 bad blocks, and since ddrecover reported the offsets (in > kbytes) I assume that's easily mapped to block numbers (I'm assuming .5k is > block 1, 500k is block 1000, etc). So I'd like to know which of the files > I've "recovered" are actually corrupted because they contained one of the > bad blocks, so that I can safely delete them. > > Does anybody know a good tool for doing this? > > Thanks, > Bob |
|
|||
|
bobdbitbucket@netscape.net (Bob) wrote in message news:<e6696cf0.0407050550.3a183167@posting.google. com>...
> > I had a vfat partition develop some bad blocks. I used ddrecover to copy what > was salvagable (i.e. most of it - 29GB - 32KB) to another disk. It > encountered 64 bad blocks, ... So I'd like to know which of the files > I've "recovered" are actually corrupted because they contained one of the > bad blocks, ... If you still have access to the bad medium, the following might work, assuming at least one copy of the FAT is good on the partition: the following technique depends on the operating system (and then the application) reporting a failed read caused by a bad sector, which I've found is most often the case. $ su root # mkdir -p /bad # mount -t vfat /dev/bad_part /bad # find /bad/ -exec dd if='{}' of=/dev/null ';' \ 2>/var/tmp/bad_files.log Notice that we're giving every file on the partition individually to the 'dd' command, logging the errors. The 'if=file of=/dev/null' part will attempt to read all the data of the file, and when the vfat driver encounters a bad sector, this error should cause 'dd' to stop processing the file and then report the error, which will be logged to '/var/tmp/bad_files.log'. Notice I did not specify the 'conv=noerror' option to dd since we want the errors to be logged. See dd(1). Of course, you could also use ddrecover or whatever utility you used, in place of 'dd' as I showed in that example; as long as the utility reliably reports a failed read (with the filename) to the stderr (fd 2), that technique should give you a log of all the bad files. |