Should I run chkbit on my whole drive?

You would typically run it on your content that you want to keep (e.g., your pictures, music, videos).

If you want to index everything take a look at the atom mode.

I wish to use a different hash algorithm

chkbit now uses blake3 by default. You can also specify --algo sha512 or --algo md5.

Note that existing index files will use the hash that they were created with.

How can I export data from the JSON files?

You can use any tool that supports JSON or even just a text editor.

For example, if you have jq installed:

# atom mode, list all files in the index (per folder):
jq '.data | to_entries | map({key: .key, value: (.value.idx | keys)}) | from_entries' .chkbit-db

# atom mode, count all files in the index:
jq '.data.[] | .idx | keys[]' -r .chkbit-db | wc -l


# split mode, list all files in the index (append "| wc -l" to count):
jq '.idx | keys[]' -r .chkbit

# split mode, list all files with their hashes:
jq '.idx | to_entries | map({key: .key, value: (.value.h)}) | from_entries' .chkbit

The chkbit json format itself is very simple:

{
  "v":             version, must be 2
  "idx": {         filename-hash index
    "FILENAME": {  on entry per file
      "mod":       file modification time (unix)
      "a":         hash algorithm
      "h":         hash
    }
  },
  "idx_hash":      hash of the index itself
  "dirlist": []    list of subdirectories
}

Can I test if chkbit is working correctly?

On Linux/macOS, you can try the following.

Create a directory and initialize it:

$ mkdir /tmp/test
$ cd /tmp/test
$ chkbit init split .

Create test and set the modified time:

$ echo foo1 > test; touch -t 201501010000 test
$ chkbit update .
new test

Processed 1 file
- 0s elapsed
- 1623.70 files/second
- 0.01 MB/second
- 1 directory was updated
- 1 file hash was added
- 0 file hashes were updated

new indicates a new file was added.

Now update test with a new modified:

$ echo foo2 > test; touch -t 201501010001 test # update test & modified
$ chkbit update .
upd test

Processed 1 file
- 0s elapsed
- 1487.17 files/second
- 0.01 MB/second
- 1 directory was updated
- 0 file hashes were added
- 1 file hash was updated

upd indicates the file was updated.

Now update test with the same modified to simulate damage:

$ echo foo3 > test; touch -t 201501010001 test
$ chkbit update .
DMG test

Processed 1 file
- 0s elapsed
- 0.00 files/second
- 0.01 MB/second
chkbit detected damage in these files:
test
error: detected 1 file with damage!

DMG indicates damage.