[cgl_discussion] [cgl_valid] Simulating a system failure to force a filesystem rec overy

Randy.Dunlap rddunlap at osdl.org
Wed Aug 7 10:23:53 PDT 2002

On 7 Aug 2002, Andy Pfiffer wrote:

| On Wed, 2002-08-07 at 09:55, Fleischer, Julie N wrote:
| > Validation -
| > As part of testing a resilient file system, I want a test case where I am
| > sure that I have simulated a system failure so that on startup fsck (I
| > believe) must be performed.  In addition, it would be even better if that
| > fsck could have to repair something (i.e., the system failure happened in
| > the middle of a logical write).
| >
| > Does anyone know how I can do this reliably?
| As far as triggering an fsck, for non-journaled filesystems that are
| listed in /etc/fstab and automatically mounted on reboot, all you need
| to do is use reboot(2) with LINUX_REBOOT_CMD_RESTART without a previous
| unmount.
| You could probably arrange to reliably cause enough dirty state to be
| stuck in the bufffer cache that some form of repair would always be
| attempted.
| You might try this: create a new directory, and in that new directory,
| randomly create, write, re-write, re-name, and unlink a few 100 files
| and directories. Make sure it runs for a few seconds (like 3), and then
| call reboot().
| Saftey tip: don't do this on an ext2-based filesystem that you expect to
| be sane when the system reboots. ;^)

For ext2/3fs, you could also use debugfs to muck with the filesystem


More information about the cgl_discussion mailing list