title: How can I simulate ext3 filesystem corruption?
body: <p>I would like to simulate filesystem corruption for the purpose of testing how our embedded systems react to it and ultimately have them fail as gracefully as possible. We use different kinds of block device emulated flash storage for data which is modified often and unsuitable for storage in NAND/NOR.</p>
  
  <p>Since I have a pretty good idea of how often data is modified in different parts of the file tree and where sensitive data is stored. I would like to inject errors in specific areas and not just randomly.  </p>
  
  <p>In cases of emergency we use <code>fsck -y</code> as a sort of last resort in order to attempt to bring the system up and report that is in a very bad state. I would very much like to cause errors which would trigger fsck to attempt repairs in order to study the effect on the systems capability to come back up.</p>
  
  <p><code>dd if=/dev/random</code> is not precise enough for my purpose since it can't easily be used to inject controlled errors. Are there any other tools or methods which fit my needs better or do I have to invent my own?</p>