Search code examples
windowsntfs

Intentionally corrupt the file system


I have to explicitly test the case what my application does if it tries to access some corrupted part of an NTFS file system. I looked around for similar questions but those were about corrupting specific files (i.e. destroy the syntax of an xml file, etc).

I need to create a scenario where chkdsk would report errors in the file system in a specific location.

Does anybody have any idea how I could provoke such a situation to test my application.

Just in case you worry: I wouldn't do that on my production system, I have a VM set up for things like that.


Solution

  • Since there is no better solution here, I did it the hard way: I used Sysinternals NTFSInfo to find the location of the Master File Table, started a Linux Live CD and edited some bits in both locations of the Master File Table (MFT). Took some time to figure out the right places, but I can produce a corrupted file system no to test the error routines in my application.

    Thanks to those contributing ideas, but I will award the answer to myself. If anybody has the same problem in the future, feel free to contact me.