Skip to content

Adding periodic borg compact after pruning #218

@sebastianberm

Description

@sebastianberm

At the moment, the system runs nicely and also prunes quite well.
However, the segments are never compacted.

After about 1.5 years on a server with a lot of changes, this resulted in:

root@dbw:~# borg info --last 1 ssh://backup/./<snip>
Archive name: backup-20250824-230501
Archive fingerprint: 44b3175af76d92f0bd10211e73ee03c8c7aed3a96ec8008a056dc0c312d5869b
Comment:
Hostname: <snip>
Username: root
Time (start): Sun, 2025-08-24 23:05:03
Time (end): Sun, 2025-08-24 23:47:18
Duration: 42 minutes 15.38 seconds
Number of files: 142637
Command line: /usr/bin/borg create --verbose --numeric-owner --compression lz4 --exclude-from /tmp/borg-backup.NYMJEe/exclude-list-borg --stats --verbose backup:<snip>::backup-20250824-230501 /
Utilization of maximum supported archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:                1.11 TB            324.94 GB             61.36 GB
All archives:               16.32 TB              4.77 TB              1.87 TB

                       Unique chunks         Total chunks
Chunk index:                 2209548              8573129

The issue here is the unique chunks vs the total chunks.
The deduplicated size here yields 1.87 TB, however, on the remote server, it takes up 2.7 TB due to the fact the chunks are never compacted.

It would be great to be able to introduce something to periodically be able to compact it as well, wouldn't you say? ;-).
Note that the documentation of Borg does not mention this should be done after each prune, as it uses quite a lot of I/O.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions