outoforderfs

FUSE single-file filesystem simulating dirty block device shutdown (each write is delayed randomly)

$ target/debug/outoforderfs Usage: outoforderfs source_file mountpoint_file blocksize maxtime_ms maxdirtyblocks outoforderfs 'mirrors' source file to mountpoint_file, but writes to mountpoint_file get delivered to source_file after a random delay, in random order. The reason is to see what happens of some other FS in case of surprise removal (or sudden shutdown) of the storage. Example session (approximate): 1$ dd if=/dev/zero bs=4096 count=2560 of=sf.dat 1$ touch mp.dat 1$ outoforderfs sf.dat mp.dat 4096 10000 100 1$ (switch to a new tab) 2$ mkfs mp.dat 2$ mount mp.dat -o loop mnt 2$ start using mnt (filling with logs, creating sqlite, etc) 1$ ^C 1$ outoforderfs sf.dat mp.dat 4096 10000 100 2$ umount mnt 2$ mount mp.dat -o loop mnt 2$ inspect mnt for breakage, incomplete/zeroed files, etc

Eye-catcher:

``` $ ./visualtest.sh

write 80 spaces to sf.dat

Contant of sf.dat against time

                                             .                              
                                             .                            . 
                                             .                            ..
            .             .                  .           .                ..
            .             .                  .           .                ..
            .             .                  .           .                ..
            .             .             .    .           .                ..
            .             .             .    .           .                ..
           .. .           .             .    .           . .              ..
           .. .           .             .    .           . .              ..
           .. .           .             .    .           . .              ..
           .. .           .             .    .           . .              ..
           .. .           .             .    .           . .              ..
           .. .           .             .    .           . .              ..
           .. .        .  .             .    .           . .              ..
          ... .        .  .             .    .           . . .            ..
          ... .        .  .             .    .           . . .            ..
          ... .        .  .             .    .           . . .            ..
          ... .        .  .             .    .           . . .            ..
          ... .      . .  .             .    .           . . .        .   ..
     .    ... .      . .  .             .    .           . . .        .   ..
     .   .... .      . .  .             .    .           . . .        .   ..
     .   .... .      . .  .             .    .           . . .        .   ..
     .   .... .      . .  .       .     .    .           . . .        .   ..
     .   .... .      . .  .       .     .    .           . . .        .   ..
     .   .... .      . .  . .     .     .    .           . . .        .   ..
     .   .... .      . .  . .     .     .   ..           . . .        .   ..
     .   .... .      . .  . .     .     .   ..           . . .        .   ..
     .   .... .      . .  . .     .     .   ..           . . .        .   ..
     .  ..... .     .. .  . .     .     .   ..           . . .        .   ..
     .  ..... .     .. .  . .     .     .   ..           . . .        .   ..
     .  ..... .     .. .  . .     .     .   ..           . . .    .  ..   ..
     .  ..... .     .. .  . .     .     .   ..           . . .    .  ..   ..
     .  ..... .     .. .  . ..    .     .   ..           . . .    .  ..   ..
     .  ..... .     .. .  . ..    .     .   ..           . . .    .  ..   ..
     .  ..... .     .. .  . ..    .     .   ..           . . .    .  ..   ..
     .. ..... .     .. .  . ..    .     .   ..           . . .    .  ...  ..
     .. ..... .     .. .  . ..    .     .   ..         . . . .    .  ...  ..
     .. ..... .     .. .  . ..    .     .   ....       . . . .    .  ...  ..
     .. ..... .     .. .  . ..    .     .   ....       . . . .    .  ...  ..
     .. ..... .     .. .  . ..    .     . . ....    .  . . . .    .  ...  ..

. .. ..... . .. . . .. . . . .... . . . . . . ... .. . .. ..... . .. . . .. . . . .... ... . . . . . ... .. . .. ..... . .. . . .. . . . .... ... . . . . . ... .. . .. ..... . .. . . .. . . . .... ... . . . . . ... .. . . .. ..... . .. . . .. . . . .... ... . . . . . ... .. . . .. ..... . .. . . .. .. . . .... ... . . . . . ... .. . . .. ..... . .. . . .. .. . . .... ... . . . . . ... .. . . .. ..... . . .. . . .. .. . . .... ... . . . . . ... ..

Now write 80 asterisks to mp.dat

. . .. ..... . . .. .. . .. .. . . .... ... . . . . . ... .. . . .. ..... . . .. .. . .. .. . . .... ... . . . . . ... .. . . . ..... . . .. ... .. .. * . .... ... . . . . . ... .. . . *. ..... . . .. ... .. .. * . .... ... * . . . . ... .. . . *. ..... . . .. ... .. .. * . .... ... * . . . . ... .. . *. *. ..... . . .. ... .. .. * . .... ... * . . . . ... .. . *. *. .... . . .. ... .. .. * . .... ... * . . . *. ... .. . *. *. .... . . .. ... .. .. * . .... ... * . . . *. ... .. . *. *. .... . . .. ... .. . * . .... ... * . . . . ... .. . *. *. .... . . .. ... .. . * . .... ... * . . . . ... .. . *. *. .... . . .. ... .. . * . .... ... * . . . . ... .. . *. *. .... . . .. ... .. . * . .... ... * .. . *. ... .. . *. *. .... . . .. ... .. . * . ... ... * .. . * ... .. . *. *. .... . . .. ... .. . * . ... ... * .. . * ... .. . *. *. .... . . .. ... .. . * . ... ... * .. . * ... .. . *. *. .... . . .. ... .. * . * . ... ... * .. . * ... .. . *. *. ...* * . .. ... .. * .* * . ... ... * .. . * ... .. . *. *. ...* * . .. ... .. * .* * . ... ... * .. . * ... .. . *. *. ...* * . .. ... .. * .* * . ... ... * .. . * ... .. . *. *. ...* * . .. ... .. * .* * . ... ... * .. . * ... .. . *. *. ...* * . .. ... .. * .* * * . ... ... * .. . * ... .. . *. *. ...* * . .. ... .* * .* * * . ... ... * .. . * ... .. . . *. ...* * . .. ... . * .* * * . ... *... * .. . * ... .. . . *. ... * ... ... . * .* * * . ... *... * .. . * ... .. . . *. ... * ... ....* * .* * * . ...... * .. . * ...* .. . . *. ... * ... ....* * .* * * . ...... * .. . * ...* .. . *. *. ... * ... ....* * .* * * . ...... * .. . * ...* .. . *. . ... * ... ....* * .* * * . ...... * .. . ...* .. . *. . ... * ... ....* * .* * * . ...... * .. . ...* .. . *. . ... * ....... * * * * *...... * .. . ..... . *. ....* * ....... * * * * *...... * .. . .... *. *. ....* * ....... * * * ..... * .. . .... .. ....* * ....... * * * ..... * .. . .... .. ....* * ....... * * * ..... .. . * .... *.. ....* *....... * * * ...*. .. . *.... *.. ....* *....... * * *.... ... *.... *..* .... ......* * * .... ... *.... *..* .... ......* * * .... ... *.... *..* .... ......* * * .... ... *.... *..* .... ......* * ...*. *... *.... *......* ......* * ...*. *... *.... *......**...... ...*.... .... *..*..*...... ....... *..* *..*.*......****.......*.. *..*.*......****.......*.. *..*.*......****.......*.. *..*.*......****.......*.. *..*.*......****.......*.. *.*****......****...*....*.. *.*****......****...*....*.. *.*****......****...*....*.*.* ^C 16 dirty blocks lost ```