Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.53 KB

README.md

File metadata and controls

40 lines (26 loc) · 1.53 KB

cofi — corruption finder

Build status

This is a simple tool that is designed to determine whether any data gets corrupted during I/O to a file.

It generates random data blocks, calculates blake3 hashes for them, writes blocks to a target file, afterwards reads the data back and compares the hashes. This procedure repeats forever until stopped manually, or until corruption gets detected.

The tool was used successfully in many production cases to prove that corruption was happening.

  • On Windows the WinAPI FILE_FLAG_NO_BUFFERING flag is used, to disallow any caching on the OS level, and additionally FILE_FLAG_WRITE_THROUGH during the writing stage.
  • On Linux: O_SYNC and O_DSYNC flags during writing.

Usage

USAGE:
    cofi.exe [OPTIONS] <blocksize> <filesize> <path>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -t, --threads <threads>    The number of concurrent workers. Each worker works with a separate file. [default: 1]

ARGS:
    <blocksize>    Block size of I/O operations. K, M, G and T suffixes are supported.
    <filesize>     Size of the file(s) to create. K, M, G and T suffixes are supported.
    <path>         Path to the file(s) to create.

Example

cofi 1M 100G d:\testfile.dat -t 4

Building from source

  1. Install Rust https://www.rust-lang.org/
  2. Run cargo build --release in the project folder.