I need to take a backup of an SQLite3 DB matching the state of other applications writing to disk, besides a vault using the filesystem as a backend.

I need to do this in a system with no ZFS so no snapshots could be taken.

Currently trying a basic script with something like this:

DAY=$(date +%d)

TDIR=$(mktemp -d)
cleanup() {
    test -n "${TDIR}" && test -d "${TDIR}" && rm -rf "${TDIR}"
trap cleanup EXIT

# define and create the working directory
mkdir "${WRKDIR}"

# take dump of the sqlite db
sqlite3 /data/data/test.db ".backup '${WRKDIR}/test.db'"

# backup the vault keys
cp -R /data/vault/ ${WRKDIR}/vault

# backup logs
cp -R /data/logs/ ${WRKDIR}/logs

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.