brd - Man Page

scans directories and files for damage due to decay of storage medium.

Synopsis

Scanning Directories

brd [general-options] scan [scan-options] target [target ...]

Listing Database Contents

brd [general-options] list [list-options] [target ...]

Searching for Duplicate Files

brd [general-options] dupe_files [dupe_files-options]

Searching for Duplicate Subtrees

brd [general-options] dupe_trees [dupe_trees-options]

Diffing Trees

brd [general-options] diff [diff-options] left-target right-target

Removing Items from the Database

brd [general-options] rm [rm-options] target [target ...]

Checking the Database

brd [general-options] checkdb [checkdb-options]

general-options

[-h] [--version] [-l,--log [FILENAME]]
[-v,--verbose] [-d,--debug] [--db [FILENAME]]

scan-options

[-h] [--use-root [ROOT_NAME]]
[--root-prefix [PREFIX]]] [-p,--prune]
[-P,--progress] [--check-only] [--dry-run]
[-s,--skip-recent] [--expr [DAYS]]

list-options

[-h] [--use-root [ROOT_NAME]] [-m,--minimal]
[--root-prefix [PREFIX]]] [-e,--expanded]

dupe_files-options

[-h] [-o,--output [FILENAME]]

dupe_trees-options

[-h] [-o,--output [FILENAME]] [--nofilefp]
[--nofilename] [--nosubdirfp] [--nosubdirname]
[--nodirname]

diff-options

[-h] [-o,--output [FILENAME]]
[--use-root [ROOT_NAME]]] [--root-prefix [PREFIX]]

rm-options

[-h] [--use-root [ROOT_NAME]]
[--root-prefix [PREFIX]]] [--dry-run]  

checkdb-options

[-h] [-P,--progress] [--check-only] [--dry-run]

Description

Bit Rot Detector, or brd, is a tool to scan a directory tree and check each file for corruption caused by damage to the physical storage medium or by damage from malicious programs. Files are fingerprinted using the SHA-1 algorithm. File fingerprints, sizes, and modification times are stored in a SQLite database.

Multiple unrelated directory trees can be stored in the same database. All trees are identified by the base directory, or root, as specified on the  command-line. Note that the following are considered different trees:
   some_dir/
   ./some_dir/

Subtrees can be specified anywhere roots can as long as the full root to subtree path is specified. However, the subtree must already exist in the database. If the subtree is not currently in the database, it will be considered to be a new root. For example, the following will scan some_dir as a new root and add  all of its children to the database, then scan the subtree some_subtree for problems and/or changes:
   # Add new root
   brd scan some_dir
   # Scan only part of a root for problems and changes.
   brd scan some_dir/some_subtree

Note: the default behavior for scan is to update the database for any files that are newer than the database record. Files that have been tampered with will likely be flagged as updated and not as damaged. To properly check for files that have been tampered with, run scan with the --check-only option.

Since scanning large trees or trees with large files can take quite a while, it is possible to exclude files in directories that have recently been checked via the -s option. How recent is "recent" is controlled by the --expr option and defaults to 30 days.

The integrity of the database can be checked via the checkdb subcommand.

In addition to checking files for corruption, brd provides the ability to search the database for duplicate files and subtrees, as well as diff subtrees. See the dupe_files, dupe_trees, and diff subcommands for details.

General Options

These options can be used in all the different modes.

-h,  --help

Display the command-line help. When specified after a subcommand name,  subcommand-specific help will be displayed.

--version

Displays script version number and quits.

-l,--log FILENAME

Logs output to the specified file instead of the console.

-v,--verbose

Enables additional messages to screen and/or log file.

-d,--debug

Enables debug messages to screen and/or log file.

--db FILENAME

Specifies the name of the database to use. Defaults to "./brd.db"

Scanning Options

The following options are available with the scan subcommand:

--use-root ROOT_NAME

Strips the path information from all targets and uses the specified ROOT_NAME instead, when interacting with the database.

--root-prefix PREFIX

Appends the specified PREFIX to each target when interacting with the  database useful for only scanning a subtree as opposed to the entire tree.

-p,--prune

Removes all records for files and directories that no longer exist. If this option is not specified, missing files and directories will generate a warning.  With this option, missing items will be noted only if --verbose is used.

-P,--progress

Displays a progress indicator.

--check-only

Behaves like normal, except that no changes are committed to the database.

--dry-run

This command is a synonym for --check-only.

-s,--skip-recent

Skips recently scanned directories and their contents. Default cut-off is 30 days. See --expr for how to specify the cut-off.

--expr DAYS

Scans are considered recent for up to, and including, DAYS days. The default value is 30 days. See --skip-recent for info on skipping recently scanned directories and their contents.

Listing Options

The following options are available with the list subcommand:

--use-root ROOT_NAME

Strips the path information from all targets and uses the specified ROOT_NAME instead, when interacting with the database.

--root-prefix PREFIX

Appends the specified PREFIX to each target when interacting with the  database useful for only scanning a subtree as opposed to the entire tree.

-m,--minimal

When displaying information on directory targets, only directory contents are displayed.

-e,--expanded

Displays additional information for directory targets.

Duplicate Files Options

The following options are available with the dupe_files subcommand:

-o,--output FILENAME

Writes the list of duplicate files to the specified file name. Useful when --verbose or --debug are used.

Duplicate Subtrees Options

The following options are available with the dupe_trees subcommand:

-o,--output FILENAME

Writes the list of duplicate subtrees to the specified file name. Useful when --verbose or --debug are used.

--nofilefp

When generating the fingerprint for a directory, do not include  the  fingerprints of files associated with it.

--nofilename

When generating the fingerprint for a directory, do not include the file names of files associated with it.

--nosubdirfp

When generating the fingerprint for a directory, do not include the fingerprints of subdirectories.

--nosubdirname

When generating the fingerprint for a directory, do not include the names of subdirectories.

--nodirname

When generating the fingerprint for a directory, do not include the directory's name.

Diff Options

The following options are available with the diff subcommand:

-o,--output FILENAME

Writes the results to the specified file name. Useful when --verbose or --debug are used.

--use-root ROOT_NAME

Strips the path information from all targets and uses the specified ROOT_NAME instead, when interacting with the database.

--root-prefix PREFIX

Appends the specified PREFIX to each target when interacting with the  database useful for only scanning a subtree as opposed to the entire tree.

Removal Options

The following options are available with the rm subcommand:

--use-root ROOT_NAME

Strips the path information from all targets and uses the specified ROOT_NAME instead, when interacting with the database.

--root-prefix PREFIX

Appends the specified PREFIX to each target when interacting with the  database useful for only scanning a subtree as opposed to the entire tree.

--dry-run

Behaves like normal, except that no changes are committed to the database.

Database Check Options

The following options are available with the checkdb subcommand:

-P,--progress

Displays a progress indicator.

--check-only

Behaves like normal, except that no changes are committed to the database.

--dry-run

This command is a synonym for --check-only.

See Also

README
http://github.com/jsbackus/brd/wiki

Authors

Jeff Backus <jeff.backus@gmail.com>

Info

28 May 2014 Jeff Backus