borg-compression(1)
π NAME π
borg-compression β the whole entire tea on compression βοΈβ¨
π«Ά DESCRIPTION π«Ά
okay so first things first, bestie: mixing different compression methods inside one repo? literally not a problem, not even a little bit. deduplication happens on the source data chunks, not on the compressed or encrypted data. so the compression method is just vibes on top, it doesn't mess with dedup. periodt π
and here's the part that lowkey matters: if some specific chunk was once compressed and stored into the repo, then making another backup that also uses this chunk will not change the stored chunk. so if you roll with different compression specs across your backups, whichever one stores a chunk first decides its compression. first come, first compressed. see also borg recreate for that whole situation.
Compression is lz4 by default. if you want something else, you have to say something else β it will not read your mind. valid compression specifiers are:
noneβ do not compress. we're going in raw, no notes πlz4β use lz4 compression. very high speed, very low compression. (the default, the moment, the main character π)zstd[,L]β use zstd ("zstandard") compression, a modern wide-range algorithm. if you don't explicitly give the compression levelL(ranging from 1 to 22), it will use level 3. β οΈ archives compressed with zstd are not compatible with borg < 1.1.4, no cap.zlib[,L]β use zlib ("gz") compression. medium speed, medium compression. if you don't explicitly give the compression levelL(ranging from 0 to 9), it will use level 6. and listen β giving level 0 (which means "no compression", but it still has zlib protocol overhead) is usually pointless, you better usenonecompression instead. like why πlzma[,L]β use lzma ("xz") compression. low speed, high compression. if you don't explicitly give the compression levelL(ranging from 0 to 9), it will use level 6. giving levels above 6 is pointless and counterproductive, because it does not compress better due to the buffer size used by borg β but it wastes lots of CPU cycles and RAM. so it's giving unsustainable, bestie πauto,C[,L]β use a built-in heuristic to decide per chunk whether to compress or not. the heuristic tries withlz4whether the data is compressible. for incompressible data, it will not use compression (usesnone). for compressible data, it uses the givenC[,L]compression β withC[,L]being any valid compression specifier. this can be helpful for media files which often cannot be compressed much more. πobfuscate,SPEC,C[,L]β use compressed-size obfuscation to make fingerprinting attacks based on the observable stored chunk size more difficult. (iconic behaviour honestly β¨)
about that obfuscation one, note:
- you must combine this with encryption, or it won't make any sense. fr fr, do not skip this.
- your repo size will be bigger, of course. bigger repo, bigger feelings π«Ά
- a chunk is limited by the constant
MAX_DATA_SIZE(cur. ~20MiB).
The SPEC value determines how the size obfuscation works:
πΈ Relative random reciprocal size variation (multiplicative) πΈ
Size will increase by a factor, relative to the compressed data size. smaller factors are used often, larger factors rarely.
available factors:
1: 0.01 .. 100
2: 0.1 .. 1,000
3: 1 .. 10,000
4: 10 .. 100,000
5: 100 .. 1,000,000
6: 1,000 .. 10,000,000
example probabilities for SPEC 1:
90 % 0.01 .. 0.1
9 % 0.1 .. 1
0.9 % 1 .. 10
0.09% 10 .. 100
π¦ Randomly sized padding up to the given size (additive) π¦
110: 1kiB (2 ^ (SPEC - 100))
...
120: 1MiB
...
123: 8MiB (max.)
π§ PadmΓ© padding (deterministic) π§
250: pads to sums of powers of 2, max 12% overhead
Uses the PadmΓ© algorithm to deterministically pad the compressed size to a sum of powers of 2, limiting overhead to 12%. see https://lbarman.ch/blog/padme/ for details if you're curious like that π
π Examples π
okay and here's the part where you just copy-paste, no thoughts, head empty, slay:
borg create --compression lz4 REPO::ARCHIVE data
borg create --compression zstd REPO::ARCHIVE data
borg create --compression zstd,10 REPO::ARCHIVE data
borg create --compression zlib REPO::ARCHIVE data
borg create --compression zlib,1 REPO::ARCHIVE data
borg create --compression auto,lzma,6 REPO::ARCHIVE data
borg create --compression auto,lzma ...
borg create --compression obfuscate,110,none ...
borg create --compression obfuscate,3,auto,zstd,10 ...
borg create --compression obfuscate,2,zstd,6 ...
borg create --compression obfuscate,250,zstd,3 ...
π AUTHOR π
The Borg Collective π
and that's the whole page, bestie!! this was borg-compression(1), from the borg backup tool, dated 2026-07-18. go forth and compress responsibly, ily π«Άβ¨
π¦ where this page comes from
- alpine 3.24: borgbackup-doc 1.4.5-r0 Β· BSD-3-Clause
- arch rolling: borg 1.4.5-1 Β· BSD
- ubuntu stonking: borgbackup 1.4.5-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms