Scans and ingest

Scanning on a schedule, automatic ingest, what to keep, and checking the numbers.

Scans

Weekly scans suit most research filesystems; nightly ones suit smaller filesystems or ones you watch closely. A scan of a billion files takes hours, so each scan gets its own folder, and only scans that verify are loaded.

pinax-ingest looks for scan folders (with a manifest.json) up to three levels below PINAX_SCAN_ROOT, oldest first, and treats each by the status fs-inventory gave it:

StatusWhat the watcher does
completeruns fs-inventory verify, then ingests it (skip the verify with --no-verify)
running, interruptedleaves it alone and looks again next time, since it may still finish or be resumed
incomplete, failedrecords it on Scans as skipped, with why (--allow-incomplete ingests incomplete ones)

A scan is matched to its filesystem by its root, and is handled once: ingested, skipped, or failed with the error, all of which show on Scans. A failed or skipped scan is never retried automatically; fix the cause and run pinax ingest SCAN_DIR by hand. Scans whose root matches no registered filesystem are named in the watcher's log and left for later. Any number of watchers and manual ingests may run at once: they share a lock in PINAX_VAR_ROOT, so one index is built at a time and no scan is ingested twice.

Scans also shows whether the watcher is alive: it reports what it is doing at every pass, and is shown as not responding when it misses three. To run it from a timer instead of as a service, use --once with the timer's interval as --interval; it exits with code 1 when a scan in that pass failed.

A scan host other than the Pinax server can scan and verify, and write into the watched folder:

dir=/scans/fast/$(date -u +%Y%m%dT%H%M%SZ)
/opt/fs-inventory/fs-inventory scan /fh/fast -o "$dir" --resolve-ids --threads 64 --stall-timeout 15m && /opt/fs-inventory/fs-inventory verify "$dir"

Notes:

Checking a filesystem's numbers

After the first scan of a filesystem, and after upgrading Pinax, check the index against fs-inventory's own computation of the same totals with pinax check SNAPSHOT_ID. It runs fs-inventory rollup on a copy of the scan's manifest (the scan folder is not written to) and compares every directory, printing the ones that differ. Rollup keeps an age histogram of about 0.5 KB for every directory down to the depth compared, so on scans with tens of millions of directories bound it, for example --age-depth 4; the other totals are still compared at every depth. Each index also records how every directory changed since the filesystem's previous scan, and the check compares that too, with a rollup of the previous scan, as long as its scan folder is kept.