Borg - commands

mail

list

Usage

list the contents

Flags

Flag Usage
(none) list the contents of a repository or an archive
--json format output as JSON when listing the contents of a repository
--json-lines format output as JSON when listing the contents of an archive

Example

list the contents of a repository :

pathToRepo='path/to/myBorgRepository'; borg list "$pathToRepo"
myArchive_1			Tue, 2024-09-17 08:47:35 [2a0f7a9ac52ec42662abeaabf77fc717698e4f623f0fb72baabdf0be0250f8df]
myArchive_2			Thu, 2024-09-26 08:37:17 [30d732bf3d092bb4bf8044c10d7dc55186964af7009c7623169097699af93b9f]
myArchive_3			Fri, 2024-10-04 19:32:58 [6ba6c7971d86363048c14bacd0984e79048f7e83f1151e65d3aece555073cc44]
myArchive_4			Mon, 2024-11-18 17:09:55 [8b65fd389bf929a5639894b5481709afefe517837682966f053725d3350f4875]

list the contents of an archive :

pathToRepo='path/to/myBorgRepository'; archive='myArchive_4'; borg list "$pathToRepo"::"$archive"

(files of the archive)
mail

info

Usage

Display detailed information about the specified

Example

info about a repository

pathToRepo='path/to/myBorgRepository'; borg info "$pathToRepo"
Repository ID: 2ff2d7215ff6f4fb9e0591d365f70799d4e09fd97c795b0a4c7981fc445fd9d6
Location: path/to/myBorgRepository
Encrypted: No
Cache: /home/stuart/.cache/borg/2ff2d7215ff6f4fb9e0591d365f70799d4e09fd97c795b0a4c7981fc445fd9d6
Security dir: /home/stuart/.config/borg/security/2ff2d7215ff6f4fb9e0591d365f70799d4e09fd97c795b0a4c7981fc445fd9d6
--------------------
                       Original size      Compressed size    Deduplicated size
All archives:              104.00 GB             68.89 GB             15.99 GB

                       Unique chunks         Total chunks
Chunk index:                  173571               593548

info about an archive

pathToRepo='path/to/myBorgRepository'; archive='myArchive_4'; borg info "$pathToRepo"::"$archive"
Archive name: myArchive_4
Archive fingerprint: 8b65fd389bf929a5639894b5481709afefe517837682966f053725d3350f4875
Comment:
Hostname: myPC
Username: stuart
Time (start): Mon, 2024-11-18 17:09:55
Time (end): Mon, 2024-11-18 17:11:29
Duration: 1 minutes 33.90 seconds
Number of files: 140988
Command line: /usr/bin/borg create --list --exclude-from borg_excludes --progress --stats -v 'path/to/myBorgRepository::{now:%Y-%m-%d}' /home/stuart
Utilization of maximum supported archive size: 0%
------------------------------------------------------------------------------
	                   Original size      Compressed size    Deduplicated size
This archive:               24.07 GB             16.13 GB              1.82 GB
All archives:              104.00 GB             68.89 GB             15.99 GB

	                   Unique chunks         Total chunks
Chunk index:                  173571               593548
mail

compact

Usage

Flags

Flag Usage
--progress depending on the amount of segments to process, compact may take a while, so --progress will tell you what's going on
--threshold n a segment is compacted if the amount of saved space is > n% (defaults to 10%)
--verbose output an estimate of the freed space
mail

delete

Usage

delete
Storage space is not freed until you run borg compact.

Example

see delete archive or repository
mail

create

Usage

Create a backup archive containing all files found while recursively traversing all paths specified

Flags

Flag Usage
-C compression
--compression=compression
with compression : algorithm,ratio
algorithm ratio speed compression notes
lz4 N/A very fast low default
zstd 1 fast low suggested over zlib and lzma (needed mostly for compatibility with old Borg versions)
22 slow high
none N/A very fast disabled
-n
--dry-run
  • simulate the backup without actually creating or modifying archives
  • to check the effect of exclude patterns, run
    borg create --list --dry-run [exclude option] [repo + archive + other options]
  • conflicts with --stats
-e pattern
--exclude pattern
exclude paths matching pattern :
borg create [other options] --exclude '*~' --exclude '*pyc'
Patterns must be quoted to be protected from shell expansion.
--exclude-from myExcludeFile read exclude patterns from myExcludeFile, one per line (details) :
  • patterns must NOT be quoted (otherwise, they won't match and would be like "ignored")
  • the leading / of an absolute path must be omitted
  • lines starting with a # are comments
--list output list of files, with a leading single-letter prefix (source) :
  • uppercase : status of a regular file relative to the "files" cache
    • A : added
    • C : changed during backup
    • E : error
    • M : modified
    • U : unchanged
  • lowercase : object type
    • - : included but not added because of dry run
    • d : directory
    • h : hardlink
    • s : symlink
    • x : excluded by the patterns
-s --stats print statistics for the created archive

Example

see make a backup