Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a line-of-business utility that will, among other tasks, run chkdsk.exe in read-only mode on NTFS secondary data hard disks. To fully test my utility I need to induce a state on one of these disks which chkdsk will detect as an error... preferably in a way that does not destroy existing data on the disk. What is the easiest way to do this?


Ideally I'd like to create a dummy text file on one of these drives and then mess up that file in such a way that chkdsk thinks it needs to be fixed. I'm not sure how to go about messing up a file.

share|improve this question

You can simply give an invalid command-line:

c:\>chkdsk FailPlease
The drive, the path, or the file name is not valid.
c:\>echo %ERRORLEVEL%
share|improve this answer
Definitely a simple way to accomplish what I asked, so upvote for that. However I'd have to hard-code an incorrect volume name which isn't exactly what I'm looking to do. Thanks for helping me clarify my question. – Jared May 7 '12 at 20:53

I think you want something that can reliably mount filesystem as a drive from a corrupted (or pseudo-corrupted state). First thing that comes to my mind is TrueCrypt

Now your script can make a copy of the image, mount the copy, let chkdsk attempt to fix, and then blow your image away.

share|improve this answer
Mounting an unformatted file container might be the way to go, though I'm hoping there's an easy way to mess up a dummy file on the actual disk. Thanks for helping me clarify my question. – Jared May 7 '12 at 20:55
Well, with an image file, you could go about randomly changing bytes in the image and see what happens. You don't even need to use TrueCrypt, you could use something like ImDisk and work with non encrypted containers. – afrazier May 7 '12 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.