Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
You have not mentioned human/operator error....like using fdisk to improperly resize a file. Also, writing to the disk raw or block device as though it were a standard file as the root user. –  mdpc May 6 '11 at 23:43
add comment

3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
The reason I am asking about kernel errors is because lately I came across this one: kernel BUG at /build/buildd/linux-2.6.31/fs/ext4/inode.c:1853!. This occurs randomly on kernel 2.6.31-22.70. I have many machines with this kernel, but only one shows it. I can't catch it so far, but I really would love to. Thanks! –  grs May 7 '11 at 19:40
add comment

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.

share|improve this answer
add comment

1) Another source of corruption that's lots of Fun is overlapping partitions. You can run for months with the end of one partition overlapping the beginning of another by just one sector. Or more!

2) The sg3-utils package has some nice low-level SCSI commands you can use to muck about with a disk. For example:

sg_write_long -w -l 16384 /dev/sda

Writes an uncorrectable error to sector 16384 of /dev/sda (well, it actually just tells the drive there's an uncorrectable error there).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.