title: Simulate a faulty block device with read errors?
body: <p>I'm looking for an easier way to test my application against faulty block devices that generate i/o read errors when certain blocks are read.  Trying to use a physical hard drive with known bad blocks is a pain and I would like to find a software solution if one exists.</p>
  
  <p>I did find the <a href="http://www.iscsitakeoverwatch.com/index.php/Linux_Disk_Failure_Simulation_Driver" rel="noreferrer">Linux Disk Failure Simulation Driver</a> which allows creating an interface that can be configured to generate errors when certain ranges of blocks are read, but it is for the 2.4 Linux Kernel and hasn't been updated for 2.6.</p>
  
  <p>What would be perfect would be an losetup and loop driver that also allowed you to configure it to return read errors when attempting to read from a given set of blocks.</p>