Compressed archives
When creating a new archive, you can also use the --compression or the -C command option to create a compressed backup archive. Borg defaults to using LZ4, which is fast but offers little compression.
Borg also supports other compression algorithms such as zstandard, zlib and lzma. You can use a mix of compression algorithms for different archives within the same repository. This is because deduplication is done on the source data chunks.
With the exception of the default LZ4, all other algorithms expect a compression level. For zstd, the compression levels range from 1-22, while for zlib and lzma, the options are 0-9. borg create --compression lzma,4 repo/path::archive-name datasources creates an archive using the lzma algorithm.
You can also direct Borg to decide for itself whether the data needs to be compressed or not. This is done with the
auto command option. Borg attempts to use the lz4 compression on each file, and should the file be compressive, uses the defined compression algorithm and level:
$ borg create --compression auto,lzma,4 repo/path::archive-name data-sources
Borg will first test each file’s compressibility using the lz4 algorithm. If the file can be compressed, Borg will compress it using the lzma with level 4.