Linux – How to cause file system corruption for test purposes

corruptionfilesystemslinuxwindows

AFAIK the reasons for file system corruption are as follows:

  • improper shutdown (hard reset);
  • hardware failures (bad block on disk, bad disk controller);
  • improper startup (mounting damaged file system);
  • kernel errors (really like to test this one).

Questions:

  1. Is there some other reason for file system corruption, which I missed?
  2. How to artificially cause file system corruption – I know about dd, but is there something more than this?

I am curious about Linux, but probably this will apply to Windows as well.

Best Answer

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.