API reference

CLI reference

glesha help COMMAND and man glesha-COMMAND show the same information offline.

Command syntax

glesha [global options] COMMAND [arguments] [options]

These rules apply to every command:

  • Options can appear before or after positional arguments.
  • Global options can appear before or after the command name.
  • An option value can follow an equals sign or a space: --format=json and --format json are the same.
  • -- ends option parsing. Use it for a path that starts with -.
  • glesha COMMAND --help prints the same text as glesha help COMMAND.

Value types

PlaceholderMeaning
SETA set name or a set UUID.
REMOTE...One or more remote names. Separate them with commas, or repeat the option: --to aws,b2 is the same as --to aws --to b2. Duplicates are removed, and the order is kept.
SNAPSHOT, IDA snapshot UUID. Where the option allows it, latest selects the newest snapshot.
SIZEA whole number with an optional unit: KiB, MiB, GiB, KB, MB, or GB. --spool-max also accepts K, M, and G as decimal units.
FILE|-A file path, or - for standard input.

Bucket access

When a command receives --from, --to, or both, glesha accesses only the buckets that those options name. A command that needs any other bucket fails before it contacts that bucket.

The meaning of each option depends on the command:

  • --to names destinations for create, configure, run, move, upload, and check. For other commands, it only adds buckets that the command may access.
  • --from names sources in fallback order for restore, import, and download. For other commands, it names the buckets that the command may read.

Global options

Every command accepts these options.

OptionDescription
--config FILETOML configuration file. The default path is in Configuration.
--state-dir DIRLocal state directory. Overrides [catalog] directory.
--env FILELoad environment variables from FILE. Variables already set in the environment keep their values.
--format FORMATResult format: plain or json. status also accepts table and csv. Default: plain.
--color MODEauto, yes, or no. Default: auto.
-L, --log-level LEVELdebug, info, warn, error, or silent. Default: info.
--progress MODEProgress on standard error: auto, plain, or off. Default: auto.
-h, --helpPrint help for the command.
-v, --versionPrint the version and build revision.

Shared option groups

Performance options

OptionDescription
--memory-max SIZEMemory budget for the command. Overrides [memory] max. Default: half of the available memory on Linux, 128 MiB on other systems. Minimum: 48 MiB.
-j N, --jobs N, --transfer-workers NMaximum number of parallel transfers. Overrides [workers] transfer. The memory budget can lower the effective number.
--hash-workers NMaximum number of parallel file hashing workers. Overrides [workers] hash.

Retrieval options

For archives in AWS cold storage.

OptionDescription
--request-retrievalAllow glesha to request retrievals, which AWS charges for. Without this option, glesha asks first.
--retrieval TIERbulk, standard, or expedited. Default: [cold] tier, which is Bulk unless you change it.
--days NNumber of days that the readable copy stays available. Default: [cold] days, which is 3 unless you change it. A pending retrieval keeps the duration it started with.

Archive options

OptionDescription
--compression FORMATxz, gzip, or bzip2.
--compression-level LEVEL1 to 9.
--prefix PREFIXPrefix for new archive names: glesha or encb.
--chunkedUpload the archive as independent encrypted chunks. --chunked=false selects a single archive.
--spool-max SIZEMaximum chunk data on local disk. Requires --chunked. Default: 128 MiB. Minimum: 2 MiB.

Commands

CommandDescription
createRegister a backup set.
configureChange the saved settings of a set or bind its roots to local directories.
runCreate and upload a full or incremental backup.
retryResume a pending operation.
restoreRestore a snapshot, or cancel unfinished restore tasks.
importRegister an existing full archive as a snapshot.
listList locally known sets.
statusShow the state, size, and estimated cost of sets.
historyList the snapshots of a set.
browseList the files in a snapshot.
catalogDiscover, unlock, synchronize, or repair catalogs.
cleanupRemove local archive copies that also exist on a remote.
deleteMove sets to the trash, or delete them permanently.
undeleteRestore sets from the trash.
moveCopy a set to another remote and switch its destination.
storage-classChange the AWS storage class of a snapshot.
checkTest upload, download, and delete access to buckets.
stateMove state from an older location.
archiveCreate a standalone encrypted archive.
decryptDecrypt an archive to a compressed tar file.
extractExtract an archive into a new directory.
uploadUpload a file to buckets.
downloadDownload a file from buckets.
helpShow help for a command.
versionShow the version and build revision.

create

glesha create SET PATH... [options]

Registers a new set named SET with one or more source directories. Each PATH becomes a root named after the last part of the path.

For a set with a remote catalog, create looks for existing state in the bucket and publishes an initial catalog. It does not create a snapshot. Run glesha run SET for the first backup.

OptionDescription
--to REMOTE...Destination remotes. Without this option, the first run --to saves its remotes as the destinations.
--from REMOTE...Other buckets that the command may access.
--catalog-to REMOTE|localCatalog location. Default: the first remote in --to. local keeps the catalog only on this computer.
--catalog-passphrase-file FILE|-Catalog passphrase.
--storage-class CLASSAWS storage class for snapshots. Default: [backup] full_storage_class.
--incremental-storage-class CLASSAWS storage class for incremental snapshots. Default: [backup] incremental_storage_class, then --storage-class.

Also accepts the archive options. The values are saved with the set.

glesha create docs ~/Documents --to b2
glesha create photos ~/Pictures --to aws,b2 --compression gzip

configure

glesha configure SET [options]

Changes the saved settings of a set, or binds its roots to directories on this computer. Settings that are stored in the catalog are synchronized before the change and published after it. Root bindings stay on this computer.

A root that is already bound cannot be bound to a different directory. The destinations of a set with incremental snapshots, and a catalog location that is already published, can be changed only with move. configure fails while the set has pending work.

OptionDescription
--root NAME=PATHBind the root NAME to the directory PATH. Repeat the option for each root.
--baseline IDMake snapshot ID the baseline of the next incremental backup. The snapshot must be complete.
--to REMOTE...Destination remotes.
--from REMOTE...Other buckets that the command may access.
--catalog-to REMOTE|localCatalog location.
--catalog-passphrase-file FILE|-Catalog passphrase.
--storage-class CLASSAWS storage class for snapshots.
--incremental-storage-class CLASSAWS storage class for incremental snapshots.

Also accepts the archive options. A new compression setting applies to future snapshots only.

glesha configure docs --compression gzip
glesha configure docs --root Documents=~/Documents
glesha configure imported --root Documents=~/Documents --to b2 --catalog-to b2

run

glesha run SET [--full | --incremental] [options]

Creates a snapshot of the set's roots and uploads it to the set's destinations.

run creates a full snapshot unless you pass --incremental. An incremental snapshot needs an earlier snapshot to build on and exactly one destination remote. That remote must hold every earlier snapshot of the set. After the first incremental snapshot, the set is bound to that remote, and every later run must use it. Use move to switch remotes.

If no file changed since the previous snapshot, run creates no snapshot and prints No changes in "SET"; no snapshot created.

If an incremental run finds removed paths or paths that changed type, glesha lists them and asks for confirmation. --assume-yes approves them.

If a previous run of the set did not finish, run resumes it with the original settings. Options that you pass must match the interrupted run, and the archive passphrase must be the same.

glesha deletes an automatically named local archive after every upload and the catalog publication succeed. It keeps the archive if you pass --keep-archive or --output, or if the run fails.

OptionDescription
--fullCreate a full snapshot. This is the default.
--incrementalCreate an incremental snapshot.
--output FILEWrite the archive to FILE, which must not exist, and keep it.
--keep-archiveKeep the local archive after a successful backup.
--archive-mode MODEauto, memory, or stream. See Archive modes.
--to REMOTE...Destination remotes for this run.
--from REMOTE...Other buckets that the command may access.
--storage-class CLASSAWS storage class for this snapshot.
--passphrase-file FILE|-Archive passphrase.
--catalog-passphrase-file FILE|-Catalog passphrase.
--assume-yesAnswer yes to confirmation prompts.

Also accepts the archive options and the performance options. A chunked run does not accept --output, --keep-archive, or --archive-mode memory.

glesha run docs
glesha run docs --incremental
glesha run docs --chunked --spool-max 128M

retry

glesha retry SET [options]

Resumes the pending operation of a set. The operation can be a backup, a move, a catalog publication, or a storage-class change. retry also repairs registry copies. Finished uploads are reused, and the original cleanup choice is kept.

OptionDescription
--archive FILEThe new location of a finished archive that was moved. glesha keeps that file after the operation. Not available for chunked runs.
--keep-archiveKeep the local archive after a successful backup. Not available for chunked runs.
--to REMOTE...Other buckets that the command may access.
--from REMOTE...Other buckets that the command may access.
--catalog-passphrase-file FILE|-Catalog passphrase.
glesha retry docs
glesha retry docs --archive /new/location/backup.tar.xz.gpg

restore

glesha restore SET --into DIR [options]
glesha restore SET --cancel [--into DIR] [options]

Restores a snapshot into DIR. DIR can be new or existing, and --into . is allowed. Existing directories are merged, and their permissions are kept. If any path that glesha would write already exists, the restore stops before it downloads archive data.

If a restore stops, run the same command again. glesha keeps the data it already verified.

If the snapshot needs archives in AWS cold storage, glesha asks for consent to request a retrieval. While the retrieval is pending, restore exits with status 3. Run the command again when the archives are ready.

With --cancel, glesha clears unfinished local restore tasks for the set. With --into DIR as well, it clears only the task for that destination. Restored files and staged data stay on disk. Retrievals that were already requested from AWS continue.

OptionDescription
--into DIRDestination directory. With --cancel, selects the task to cancel.
--snapshot ID|latestSnapshot to restore. Default: latest.
--cancelCancel unfinished local restore tasks.
--from REMOTE...Remotes to read archives from, in the order to try them. Default: the set's destinations. Local archive copies are used first when they exist. A readable copy is used before a copy that needs a retrieval.
--to REMOTE...Other buckets that the command may access.
--passphrase-file FILE|-Archive passphrase.
--archive-passphrase-file ID=FILEArchive passphrase for one snapshot. Repeat for each snapshot whose passphrase differs.
--catalog-passphrase-file FILE|-Catalog passphrase.

Also accepts the retrieval options and the performance options.

glesha restore docs --into ~/recovered
glesha restore docs --snapshot SNAPSHOT_ID --into ~/recovered --from b2,aws
glesha restore docs --into ~/recovered --request-retrieval --retrieval bulk
glesha restore docs --cancel

import

glesha import SET --file FILE [options]
glesha import SET --from REMOTE --key KEY [options]

Adds an existing full archive to the set SET as a snapshot. If SET does not exist, glesha creates it. glesha reads the archive to build the catalog. It does not change the archive or upload it again.

With --from and --key, glesha downloads the object once and records the remote copy. With --file only, the set stays local. With --file and --from, glesha reads the local file and records the remote object --key as its copy, after it checks that the sizes match. Without --key, the key is the file name.

If the set has a remote catalog location, import publishes the catalog. If the publication fails, the import is kept. Run glesha retry SET or the same import command again to finish it.

A remote object belongs to one set. import fails if another set on this computer already uses the object, because deleting either set would break the other. It also fails while another set's catalog is not on this computer, because glesha cannot check that set; run glesha catalog unlock SET first.

OptionDescription
--file FILELocal archive.
--key KEYExact object key of the archive in the remote. With --file, the default is the file name.
--from REMOTE...Remotes to read the archive from, in the order to try them.
--to REMOTE...Other buckets that the command may access.
--root NAME=PATHBind a root to a local directory.
--baseline newMake the imported snapshot the baseline of the next incremental backup. new is the only accepted value. To select another snapshot, use configure --baseline ID.
--date RFC3339Original backup date, for example 2024-01-02T03:04:05Z. Without it, the date is unknown.
--deep-verifyWith --file and --from, also download the remote object and check that its checksum matches the file.
--passphrase-file FILE|-Archive passphrase.
--catalog-passphrase-file FILE|-Catalog passphrase.

Also accepts the retrieval options and the performance options.

glesha import old-docs --file old-backup.tar.gz.gpg
glesha import old-docs --from b2 --key backups/old-backup.tar.gz.gpg
glesha import old-docs --file old-backup.tar.gz.gpg --from b2 --key backups/old-backup.tar.gz.gpg --deep-verify

list

glesha list [options]

Lists the sets in the local registry with their UUIDs. A set with a locked catalog shows (locked catalog) in place of its name. list makes no cloud requests and asks for no passphrase. To find sets that exist only in a bucket, run glesha catalog sync first.

OptionDescription
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--catalog-passphrase-file FILE|-Catalog passphrase.
--remoteDeprecated. Use glesha catalog sync, then glesha list.
glesha list
SET                             ID
docs                            87156a05-ea28-45fe-81df-bb74a4a50f3a

status

glesha status [SET] [options]

Shows one line for each set, or details for one set. By default, status reads local records only and makes no cloud requests, except to finish deletions whose trash period has ended. With --refresh, it checks the archive objects and lists the catalog objects in each bucket. It never downloads catalogs or requests retrievals.

SET    STATE   SIZE   SNAPSHOTS  STORAGE CLASS  EST/YR
docs   SYNCED  1.65K  2          B2             <$0.01
TOTAL          1.65K  2                         <$0.01
ColumnMeaning
SETSet name, or UUID if the catalog is locked.
STATEOne of the set states.
SIZEArchive size, in binary units.
SNAPSHOTSNumber of snapshots.
STORAGE CLASSThe storage class that holds the most archive bytes.
EST/YREstimated storage cost in US dollars per year.

A - means that the value is unknown. It does not mean zero.

status SET also shows the set UUID, catalog state, last backup and sync times, destinations, root bindings, and the share of bytes in each storage class. Sets with outstanding work are listed under Needs attention with a suggested next step.

If an import or restore is waiting for a cold-storage retrieval, a Retrievals table follows. Without SET, its first column is SET.

ColumnMeaning
TASKRESTORE or IMPORT.
STATEProgress of the retrieval, for example QUEUED, PARTIAL, READY, or EXPIRED.
READYNumber of archives that can be downloaded.
WAITINGNumber of archives that are not ready yet.
EXPIRESWhen the first readable copy expires, once every archive is ready.

The cost estimate covers archive and catalog storage for twelve months at current size, using prices embedded in glesha. It leaves out request fees, retrieval fees, egress, temporary readable copies, taxes, discounts, and free tiers. An asterisk (*) marks an estimate that is missing some sizes or prices.

OptionDescription
--refreshCheck remote objects. Does not request retrievals.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.

status accepts two extra formats: --format table and --format csv. CSV has fixed columns, byte counts as integers, and prices as numbers, with no totals.

glesha status
glesha status docs --refresh
glesha status --format csv

history

glesha history SET [options]

Lists the completed snapshots of a set, newest first. history reads the local catalog. If the catalog is encrypted and not open on this computer, glesha downloads it if needed and asks for the catalog passphrase. The archive passphrase is not needed.

SNAPSHOT                              CREATED               TYPE               SIZE  COPIES
b0e70271-72a4-4c79-a6fa-a9cf03eea029  2026-11-21 12:09 IST  incremental        843B  b2: readable (STANDARD)
7313fb03-1fab-48d6-89ee-9e10adb21b70  2026-11-21 12:09 IST  full               847B  b2: readable (STANDARD)

For an imported snapshot, CREATED shows the --date given at import, or -.

OptionDescription
--refreshCheck whether each archive copy is readable. Does not request retrievals.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--catalog-passphrase-file FILE|-Catalog passphrase.
glesha history docs
glesha history docs --refresh --format json

browse

glesha browse SET [options]

Lists the entries of a snapshot from the local catalog. No archive data is downloaded. By default, browse shows the top level of the latest snapshot.

TYPE              SIZE  PATH
directory            -  Documents
directory            -  Documents/notes
file                8B  Documents/c.txt
file                6B  Documents/notes/a.txt
OptionDescription
--snapshot ID|latestSnapshot to list. Default: latest.
--path PATHCatalog path to list, for example Documents/notes.
--recursiveInclude every entry below the path.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--catalog-passphrase-file FILE|-Catalog passphrase.
glesha browse docs --recursive
glesha browse docs --path Documents --snapshot SNAPSHOT_ID

catalog

glesha catalog ACTION [SET] [options]

Manages catalogs. No catalog action restores files or requests retrievals.

ActionDescription
sync [SET]Without SET, discover sets and download their catalogs. With SET, synchronize that catalog in both directions.
unlock SETOpen a downloaded catalog with its passphrase.
resolve SETReview or resolve a conflict.
pull SETReplace the local catalog with the remote catalog. The previous local catalog is kept.
push SETPublish local catalog changes.
reconcile SETMerge compatible catalog histories.
abandon SETDiscard the local work of a pending operation. The catalog and remote objects are kept. Chunk data waiting on disk can be removed.

pull, push, and reconcile accept --from, --to, and --catalog-passphrase-file. abandon accepts only the global options. glesha catalog sync SET performs pull, reconcile, and push together.

catalog sync

glesha catalog sync [SET] [options]

Without SET, glesha searches the configured buckets for sets, rebuilds the local registry, and downloads each catalog. It asks for no passphrase. Encrypted catalogs appear by UUID and are reported as locked. If one set fails, glesha continues with the others and exits with a non-zero status at the end.

With SET, glesha opens the catalog, downloads remote changes, merges compatible histories, and publishes local changes. This form can write to the bucket. If the histories conflict, sync stops and you must run catalog resolve.

glesha prints one row for each set that it updated:

ResultMeaning
Updatedglesha downloaded, repaired, or unlocked the catalog, or its revision changed.
Updated (locked)glesha downloaded the catalog, and it needs the catalog passphrase to open.

A summary line follows, for example Catalog sync complete. 1 updated; 1 locked. If a set failed, the line starts with Catalog sync incomplete. If nothing changed, glesha prints Everything is up to date. and the number of catalogs that it checked.

OptionDescription
--from REMOTE...Buckets to search or access.
--to REMOTE...Other buckets that the command may access.
--allThe same as sync without SET. Searches only the allowed buckets.
--catalog-passphrase-file FILE|-Catalog passphrase.
glesha catalog sync
glesha catalog sync --from b2
glesha catalog sync docs

catalog unlock

glesha catalog unlock SET [options]

Opens a catalog that catalog sync already downloaded. glesha uses only the local copy and makes no cloud requests. After unlocking, the set has its name again. Archives stay encrypted.

OptionDescription
--catalog-passphrase-file FILE|-Catalog passphrase.
glesha catalog unlock 87156a05-ea28-45fe-81df-bb74a4a50f3a

catalog resolve

glesha catalog resolve SET [options]
glesha catalog resolve SET --keep local|remote [options]
glesha catalog resolve SET --authority REMOTE [options]

Without --keep or --authority, glesha prints the differences between the local and remote catalog. With --keep, it keeps the references and incremental baseline of one side. Both snapshot histories are kept in either case. glesha asks for confirmation before it changes anything.

OptionDescription
--keep local|remoteKeep the local or the remote side.
--authority REMOTESelect the remote that holds the authoritative catalog.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--catalog-passphrase-file FILE|-Catalog passphrase.
--assume-yesAnswer yes to the confirmation prompt.
glesha catalog resolve docs
glesha catalog resolve docs --keep remote

cleanup

glesha cleanup SET [options]
glesha cleanup --all [options]

Removes local archive copies in the state directory when a verified copy exists on a remote. Remote backups and files outside the state directory are never removed. glesha lists the files and asks for confirmation before it removes them.

glesha skips a set that is in the CONFLICT, FAILED, PAUSED, or WAITING state, or that has an unfinished snapshot.

cleanup reads the catalog passphrase from GLESHA_CATALOG_PASSPHRASE or from a prompt. It does not accept --catalog-passphrase-file.

OptionDescription
--allProcess every set in the local registry.
--dry-runList the files that would be removed, and remove nothing.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--assume-yesAnswer yes to the confirmation prompt.
glesha cleanup docs --dry-run
glesha cleanup docs

delete

glesha delete SET... [options]

Moves each SET to the trash. glesha lists each set with its size and remotes, and asks for confirmation. The data stays in the buckets, and glesha undelete SET restores the set. A set in the trash accepts only restore, browse, history, status, list, catalog, delete, and undelete. create cannot reuse its name until the deletion finishes.

When the trash period ends, the first glesha command that can reach the set's catalog remote deletes the set and prints the space freed on stderr. Storage is billed until then. The period is [backup] trash_period in the configuration, 24 hours by default, and is saved with the set when it moves to the trash. The period is measured by the bucket's clock, so a wrong clock on this computer cannot shorten it.

With --now, or when trash_period is 0, glesha deletes each SET permanently. You type each set name to confirm, one prompt for each set, in the order given. glesha deletes every stored version of the set's archives, catalog, and registry records from every configured remote, then its local state. It keeps a small marker in each bucket that stops other computers from publishing the set again.

Archives that were added with import are deleted too. glesha keeps an archive, and names it on stderr, if another set on this computer uses it, if another set's catalog is not on this computer, or if the object is in a bucket without versions and has changed since the import. The catalog of each SET must be open on this computer, because only the catalog lists imported archives.

Once a deletion has removed data from any bucket, it cannot be undone. If a remote cannot be reached, the set stays in the DELETING state on every computer that knows it, and the next command that can reach every configured remote finishes the deletion.

OptionDescription
--nowDelete permanently now, without the trash period.
--dry-runList what would be deleted, and delete nothing.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--assume-yesAnswer yes to the confirmation prompts.
glesha delete docs
glesha delete docs photos --now --dry-run
glesha delete docs photos --now

undelete

glesha undelete SET... [options]

Takes each SET out of the trash. Nothing was deleted, so the set is restored as it was. After the trash period ends, or once a deletion has started on any remote, undelete fails.

OptionDescription
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
glesha undelete docs

move

glesha move SET --from SOURCE --to DESTINATION [options]

Copies every snapshot of the set from SOURCE to DESTINATION, verifies the copies, and makes DESTINATION the set's destination for future backups. The copies on SOURCE are kept. Name every source and catalog bucket in --from.

move does not support chunked snapshots.

OptionDescription
--from REMOTE...Source and catalog buckets.
--to REMOTE...Destination remotes.
--catalog-passphrase-file FILE|-Catalog passphrase.
--assume-yesAnswer yes to confirmation prompts.

Also accepts the retrieval options and the performance options.

glesha move docs --from aws --to b2
glesha move docs --from aws --to offsite --request-retrieval

storage-class

glesha storage-class SET --class CLASS [options]

Changes the AWS storage class of one snapshot's archive. glesha copies the object inside AWS with the new class. The archive identity and older object versions are kept. If the object is in cold storage, it may need a retrieval first.

storage-class works only with AWS copies and does not support chunked snapshots. The accepted classes are listed in Storage classes.

OptionDescription
--class CLASSNew storage class. Required.
--snapshot ID|latestSnapshot to change. Default: latest.
--from REMOTE...Buckets that the command may access.
--to REMOTE...Other buckets that the command may access.
--catalog-passphrase-file FILE|-Catalog passphrase.
glesha storage-class docs --snapshot SNAPSHOT_ID --class DEEP_ARCHIVE

check

glesha check --to REMOTE... [options]

Tests each remote with a temporary object that glesha creates. For each remote, glesha reports these steps: Safety, Write, Metadata, Read, and Cleanup. Each step shows OK, FAILED with the error, or SKIPPED. A failure on one remote does not stop the checks of the others.

glesha does not write to a bucket that has a default Object Lock retention. It never replaces or deletes existing objects. If the cleanup step fails, glesha prints the key and version of the object that remains.

Provider "b2" (b2)
  Safety     OK
  Write      OK
  Metadata   OK
  Read       OK
  Cleanup    OK
  Result      PASS

Summary: 1 passed, 0 failed.
OptionDescription
--to REMOTE...Remotes to test.
--from REMOTE...Other buckets that the command may access.

Also accepts the performance options.

glesha check --to aws,b2

state

glesha state migrate [options]

Moves state from the location used before version 0.5.2, glesha/state-v2 in the configuration directory, to the current state directory. Stop other glesha processes first.

The migration makes no cloud requests. It moves archive files without copying or re-encrypting them, so both locations must be on the same file system. It keeps copies of the original databases in .state-migration-backup in the new directory. Configuration and credential files are not touched.

The migration fails if the destination already exists. To migrate into another directory, pass a new path with --state-dir. If the migration stops, run the same command again.

glesha state migrate

archive

glesha archive PATH... [options]

Creates an encrypted archive of one or more paths. No set and no remote are needed. glesha asks for the passphrase twice.

Without --output, the archive is written to the current directory as glesha-TIMESTAMP.tar.xz.gpg. The extension follows the compression format.

OptionDescription
--output FILEOutput file. It must not exist.
--compression FORMATxz, gzip, or bzip2. Default: xz.
--compression-level LEVEL1 to 9. Default: 6.
--archive-mode MODEauto, memory, or stream.
--prefix PREFIXglesha or encb.
--storage-class CLASSAccepted and ignored.
--passphrase-file FILE|-Archive passphrase.

Also accepts the performance options.

glesha archive ~/Documents
glesha archive ~/Documents ~/Pictures --compression gzip --output personal.tar.gz.gpg

decrypt

glesha decrypt FILE [options]

Decrypts an archive, checks it, and writes the compressed tar stream to a new file. Without --output, the output file is in the same directory as FILE. Its name is the archive name with the extension of the compression format, for example .tar.xz. Use extract to unpack the files instead.

OptionDescription
--output FILEOutput file. It must not exist.
--passphrase-file FILE|-Archive passphrase.
--memory-max SIZEMemory budget. See Performance options.
glesha decrypt personal.tar.xz.gpg
glesha decrypt old.tar.gz.gpg --output old.tar.gz --passphrase-file ~/secrets/archive

extract

glesha extract FILE --into DIR [options]

Checks an archive and extracts it into DIR. FILE can be an encrypted archive or an unencrypted compressed tar file. DIR must not exist.

OptionDescription
--into DIRNew destination directory. Required.
--passphrase-file FILE|-Archive passphrase.
--memory-max SIZEMemory budget. See Performance options.
glesha extract personal.tar.xz.gpg --into ~/recovered
glesha extract personal.tar.xz --into ~/recovered

upload

glesha upload FILE --to REMOTE... [options]

Uploads a file to each remote in --to in parallel. No set is involved. glesha checks every remote before it uploads. If the key exists on any of them, the upload fails unless you pass --force.

OptionDescription
--to REMOTE...Destination remotes.
--key KEYObject key. Default: the file name.
--storage-class CLASSAWS storage class.
--forceReplace an existing object.
--from REMOTE...Other buckets that the command may access.

Also accepts the performance options.

glesha upload personal.tar.xz.gpg --to b2
glesha upload personal.tar.xz.gpg --to aws,b2 --key backups/personal.tar.xz.gpg

download

glesha download KEY --from REMOTE... [options]

Downloads the object KEY. glesha tries each remote in --from in order until one succeeds. --from is required. Without --output, the file is written to the current directory with the last component of KEY as its name.

OptionDescription
--from REMOTE...Remotes to try, in order.
--output FILEOutput file. It must not exist.
--to REMOTE...Other buckets that the command may access.

Also accepts the performance options.

glesha download backups/personal.tar.xz.gpg --from b2,aws
glesha download backups/personal.tar.xz.gpg --from b2 --output personal.tar.xz.gpg

help

glesha help [COMMAND [ACTION]]

Prints the options and examples of a command. For catalog, an action can follow, for example glesha help catalog unlock. help does not read the configuration file or credentials.

glesha help
glesha help run
glesha help catalog sync

version

glesha version
glesha --version
glesha -v

Prints the version and the build revision, for example glesha 0.5.2 (1a2b3c4). A development build prints glesha dev (unknown). version does not read the configuration file or credentials, and it accepts no arguments.

Output

glesha writes results to standard output. Progress, prompts, warnings, and errors go to standard error. You can redirect standard output to a file and still see progress.

Human output uses binary units with two decimal places, for example 14.20M. Times are shown in the local time zone.

Progress

With --progress auto and a terminal, glesha prints [+] before each step and draws a progress bar for long steps:

[63.35%] [1.27G/2.34G] [1.22M/s]

When standard error is not a terminal, or TERM=dumb, glesha prints one line per step without a bar. --progress plain selects this form on a terminal. --progress off and log levels warn, error, and silent turn progress off.

Structured output

With --format json, every command writes JSON Lines to standard output. Each line is one record:

{"version":2,"kind":"set","data":{"id":"87156a05-ea28-45fe-81df-bb74a4a50f3a","name":"docs"}}
FieldDescription
versionVersion of the record format for this kind.
kindType of record.
dataThe record. Byte counts are integers, prices are numbers, and times are in UTC.

A command that lists items writes one record per item. An empty list writes no records. Records of kind catalog_state, catalog_sync_summary, and catalog_sync_error use version 3. All other result records use version 2.

These are the result kinds:

KindWritten by
setcreate, configure, list
snapshotrun, history, import
no_changesrun when no file changed
entrybrowse
restore, restore_cancelledrestore
statusstatus
catalog_state, catalog_sync_summary, catalog_sync_errorcatalog sync
catalog_unlockedcatalog unlock
resolution_difference, resolution_choicescatalog resolve
cleanup_candidate, cleanup_removed, cleanup_summarycleanup
provider_check, check_summarycheck
downloaddownload
remote_setlist --remote
resultOther commands that report one outcome
helphelp
versionversion

With --format json, standard error also carries JSON Lines, with version 1 records. kind is progress, error, warning, info, or debug. Progress records appear when a step starts and stops, and once per second while it runs. They have these fields:

FieldDescription
idStep identifier, unique within one command.
phaseName of the step.
stateState of the step. STOPPED means that the step ended, not that it succeeded.
completed_bytesBytes processed so far.
total_bytesTotal bytes, or null if unknown.
bytes_per_secondCurrent rate.
timestampUTC time of the record.

Error records have the fields code, message, and exit_code. glesha writes them even with --log-level silent.

CodeMeaning
FAILEDThe operation failed.
INVALID_ARGUMENTThe command line is invalid.
PENDINGWork is pending, for example a cold-storage retrieval.
CONFLICTThe remote history conflicts with the local history.
CONFIRMATION_REQUIREDThe command needs a confirmation that it did not get.
CANCELEDThe command was interrupted.

--format json does not answer prompts. For unattended use, pass passphrase files and --assume-yes or --request-retrieval where needed.

Set states

status reports one of these states for each set:

StateMeaning
NEWThe set has no snapshots yet.
SYNCEDLocal records show no outstanding work. This is not a live check of the remote copies.
RUNNINGAnother glesha process is working on the set.
PAUSEDAn operation was interrupted. Run glesha retry SET, or repeat the interrupted restore or import command.
LOCALThe local catalog has changes that are not published. Run glesha catalog sync SET.
PUBLISHINGAnother glesha process is publishing the catalog of the set.
WAITINGA restore or import is waiting for a cold-storage retrieval. Repeat the command when the archives are readable.
STALELocal state is out of date. Registry copies need repair, the catalog is missing locally, or downloaded changes are not unlocked yet. The details give the command to run.
CONFLICTThe local and remote histories conflict. Run glesha catalog resolve SET.
FAILEDThe last operation failed. The details show the error.
LOCKEDThe catalog needs its passphrase. Run glesha catalog unlock SET.
TRASHThe set is in the trash. The details show when it will be deleted. Run glesha undelete SET to restore it.
DELETINGThe trash period ended or the deletion started, but it is not finished. The next command that can reach every configured remote finishes it.

Exit status

CodeMeaning
0Success.
1The operation failed.
2The command line is invalid, or a named set or snapshot does not exist.
3Work is pending, for example a cold-storage retrieval. Run the command again later.
4The remote history conflicts with the local history.
130The command was interrupted, for example with Ctrl+C.

Compatibility

Archive, catalog, and JSON output formats are versioned. Older archives, including encb archives, stay readable. compatibility.md describes the policy.