How to cause file system corruption for test purposes?

For the improper shutdown, you should be able to test using virtual machines. Write a script to load up all your applications and services. Then use an API to kill the VM and then boot it back up. Repeat... let your script run and see how long it takes to die.

For kernel errors: find an old beta kernel, eg from early Reiser or XFS or EXT4 days. Look through the bug lists and changes to find a reproducible bug.


The voice coil mechanism that positions hard drive heads uses rare earth magnets and I've gotten some pretty large, very strong magnets out of dead hard drives.

You can create disk errors on a working hard drive by taking a strong enough magnet and holding it against the top of a hard drive. Note, however, that this is not a reversible process, if it works at all it'll damage the servo tracks on the drive platters making the disk unusable.