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 additionallyFILE_FLAG_WRITE_THROUGH
during the writing stage. - On Linux:
O_SYNC
andO_DSYNC
flags during writing.
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.
cofi 1M 100G d:\testfile.dat -t 4
- Install Rust https://www.rust-lang.org/
- Run
cargo build --release
in the project folder.