forgedb backup

Create, restore, and inspect lock-free snapshot archives of a ForgeDB data directory.

Snapshot backup and restore for a database directory. create takes a lock-free full snapshot, or an incremental byte-tail delta with --incremental. restore materializes an archive, or a base + incremental chain, atomically. list inspects an archive without restoring it.

Subcommands#

CommandPurpose
createCreate a full snapshot, or an incremental delta with --incremental.
restoreRestore a full archive, or a base followed by its incrementals.
listShow an archive's contents without restoring.

create#

forgedb backup create [--data-dir <DIR>] [--output <FILE>] [--incremental --base <ARCHIVE>]
FlagType / defaultMeaning
-d, --data-dir <DIR>string (data)Data directory to snapshot.
-o, --output <FILE>string (backup.forgebk)Output archive path.
--incrementalbool (false)Produce an incremental delta instead of a full snapshot. Refused if compaction bumped the epoch since the base.
--base <ARCHIVE>stringThe base archive to delta from. Required with --incremental; may itself be an earlier incremental in the chain.

restore#

forgedb backup restore <archive>... [--output <DIR>] [--overwrite]
FlagType / defaultMeaning
<archive>...strings (required, 1+)One full archive, or a base followed by its incrementals in order.
-o, --output <DIR>string (data)Destination data directory.
--overwritebool (false)Replace an existing non-empty destination.

list#

forgedb backup list <archive> [--json]
FlagType / defaultMeaning
<archive>string (required)Archive path to inspect.
--jsonbool (false)Emit JSON.

Incrementals are a chain

Restore applies archives in order: pass the base first, then each incremental in sequence order. Restore is atomic (temp dir + rename) and refuses a non-empty destination without --overwrite.

Examples#

Full snapshot of the default data directory:

forgedb backup create --data-dir ./data --output ./snap.forgebk

An incremental delta on top of a base:

forgedb backup create --data-dir ./data --incremental \
  --base ./snap.forgebk --output ./snap-2.forgebk

Restore a base + incremental chain into a fresh directory:

forgedb backup restore ./snap.forgebk ./snap-2.forgebk --output ./restored

Inspect an archive:

forgedb backup list ./snap.forgebk --json

Search documentation

Find pages across the ForgeDB docs