Okay, that was a rather long read... lol.
I've checked the Eraser source code; exceptions that are thrown and catchable by Eraser code are properly dealt with; files are reset and closed. I say only exceptions caught by Eraser code - because if the .NET framework buckles under us, there's nothing we can do but hit the ground face first. In the case of the log message, it is a .NET exception. It does seem to be caused by a race condition: so if you can find a way to reliably replicate the crash, please share and I'll see if I can fix it.
DavidHB said:
Your reference to truncating files suggests a degree of confusion. Erasing cluster tips does not change the file size (or the file data). All it does is overwrite the unused space between the end of the file data and the end of the last block allocated to that file. That space is inaccessible under normal circumstances (you can of course read it with a hex editor); the reason for overwriting it is to remove any bits of a previously deleted file which might remain in the unused space.
That's not exactly it, either. While at the bird's eye view that's what's going on, Eraser does have to open the file, deliberately extend the file size to the nearest cluster size (so making the file size a multiple of 4096 bytes, for example), erase the gunk after the old file size, and then truncate the file back to it's original file size. A power failure when Eraser's extended the file but not reset it could corrupt the file. Eraser does take necessary safeguards though: it will refuse to wipe the cluster tips of system files, as well as files which are open in any program. This could be one of the contributions to the very bloated erase logs...
DavidHB said:
Tom1234 said:
Now about the actual process of the cluster tip erasures. ... I guess I incorrectly assumed that you would open file and start appending to the end of the file until you reached the end of the cluster and then just truncate the file to the original size, which may possibly leave corrupt file in the case of a crash. I guess I assumed wrong.
Joel is the expert on this, but, as far as I know, the process is pretty much as follows:
- read the last block to get a working copy;
- in the working copy, identify the end of the file data, and overwrite from there to the end of the working copy;
- write the working copy back to the original block location.
This may be a poor description, as Eraser works with file streams rather than the complete file constructs you and I are familiar with. What is certain however is that Eraser does not at any time change either the size of the file data or the amount of space allocated to the file in the MFT or FAT.
Now, having said my earlier paragraph, Eraser
does change the file size for the instant the cluster tips are being erased (it is, after all, just a number in the MFT). However, the amount of space allocated in the MFT and FAT does not change (since the MFT/FAT works at a cluster granularity, which we are not appending or removing any clusters)... I agree this is all a little confusing and that my explanation
can be better, but let me know what exactly requires clarification and hopefully I can clear it up.