title: Create a hard disk error on linux
body: <p>I would like to create hard drive errors on my linux box - so that I can test that the application I'm writing performs correctly when there are uncorrectable errors.</p>
  
  <p>I have an application from a hard disk manufacturer that will create bad sectors on a drive, but it is windows only - and would involve much plugging and unplugging of disks, as I am on a linux platform.</p>
  
  <p>I have seen this previous post: <a href="https://stackoverflow.com/questions/1870696/simulate-a-faulty-block-device-with-read-errors">Simulate a faulty block device with read errors?</a> but cannot use this as I don't have dmsetup available.</p>
  
  <p>I know I can use dd to corrupt files, by writing random data over files, but I would like to create a bad sector, not a readable, but corrupt file.</p>
  
  <p>Any tips much appreciated</p>
  
  <p>Thanks!</p>