Shown deduplicated archive sizes very big #1034

Closed
opened 2025-03-19 13:29:07 +00:00 by iljur · 5 comments

What I'm trying to do and why

Since I switched the database running on my server to postgresql the stats show significantly bigger deduplicated sizes for the created archives in the logs. (I don't use borgmatic's database hook but dump the db manually to a file before backup.)

I recently figured out that if I check archive sizes with "borgmatic info", it shows significantly smaller (like 2-4x) deduplicated archive sizes than shown in the respective logs.

Steps to reproduce

I run borgmatic with the --verbosity 1 switch to let it output some information.

The destilled borg command looks like this: /usr/bin/borg create --patterns-from /tmp/borgmatic-kvb5fqfu/borgmatic/tmp7bje2tct --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc --info --stats 'ssh://uxxxxxx-sub1@uxxxxxx.your-storagebox.de/./wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}'

Actual behavior

All normal, but significantly bigger archive deduplicated sizes. Other shown sizes match.

(by the way: without the "--verbosity 1/--info switch" the also used switches --stats and --show-rc seem to have no effect. Is that expected behaviour?)

Expected behavior

Show the same deduplicated archive sizes after backup like with "borgmatic info".

Other notes / implementation ideas

Don't know if this is really a borgmatic issue. Seems more like a borg thingy but wanted to check back anyway.

borgmatic version

latest

borgmatic installation method

pipx

Borg version

1.4.0

Python version

No response

Database version (if applicable)

16.8

Operating system and version

Debian 12

### What I'm trying to do and why Since I switched the database running on my server to postgresql the stats show significantly bigger deduplicated sizes for the created archives in the logs. (I don't use borgmatic's database hook but dump the db manually to a file before backup.) I recently figured out that if I check archive sizes with "borgmatic info", it shows significantly smaller (like 2-4x) deduplicated archive sizes than shown in the respective logs. ### Steps to reproduce I run borgmatic with the --verbosity 1 switch to let it output some information. The destilled borg command looks like this: /usr/bin/borg create --patterns-from /tmp/borgmatic-kvb5fqfu/borgmatic/tmp7bje2tct --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc --info --stats 'ssh://uxxxxxx-sub1@uxxxxxx.your-storagebox.de/./wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}' ### Actual behavior All normal, but significantly bigger archive deduplicated sizes. Other shown sizes match. (by the way: without the "--verbosity 1/--info switch" the also used switches --stats and --show-rc seem to have no effect. Is that expected behaviour?) ### Expected behavior Show the same deduplicated archive sizes after backup like with "borgmatic info". ### Other notes / implementation ideas Don't know if this is really a borgmatic issue. Seems more like a borg thingy but wanted to check back anyway. ### borgmatic version latest ### borgmatic installation method pipx ### Borg version 1.4.0 ### Python version _No response_ ### Database version (if applicable) 16.8 ### Operating system and version Debian 12
iljur changed title from Shown deduplicated archive size to Shown deduplicated archive sizes very big 2025-03-19 13:30:17 +00:00
Owner

borgmatic doesn't filter the borg info output archive sizes, so if you're seeing a particular archive size number there, it's coming directly from Borg. Same thing for borg create --stats output. But if you'd like to debug this further, can I get a look at the output for both borgmatic info and borgmatic create --stats? Feel free to redact as necessary.

(by the way: without the "--verbosity 1/--info switch" the also used switches --stats and --show-rc seem to have no effect. Is that expected behaviour?)

I'm not sure I understand the situation here. borgmatic doesn't have a --show-rc flag, but Borg does. And borgmatic only passes --show-rc to Borg when borgmatic's --verbosity 2 is set. As for create --stats (which I assume you're referring to here), I get stats output regardless of the borgmatic verbosity level. Are you seeing otherwise? If so, can I see your command and configuration?

borgmatic doesn't filter the `borg info` output archive sizes, so if you're seeing a particular archive size number there, it's coming directly from Borg. Same thing for `borg create --stats` output. But if you'd like to debug this further, can I get a look at the output for both `borgmatic info` and `borgmatic create --stats`? Feel free to redact as necessary. > (by the way: without the "--verbosity 1/--info switch" the also used switches --stats and --show-rc seem to have no effect. Is that expected behaviour?) I'm not sure I understand the situation here. borgmatic doesn't have a `--show-rc` flag, but Borg does. And borgmatic only passes `--show-rc` to Borg when borgmatic's `--verbosity 2` is set. As for `create --stats` (which I assume you're referring to here), I get stats output regardless of the borgmatic verbosity level. Are you seeing otherwise? If so, can I see your command and configuration?
Author

I am backing up to 2 different locations so there is a "common.yaml" with the general parameters for the backup and one config file for every location with the specific parameters. Please find the common.yaml attached. As you can see there I am passing the --stats and --show-rc as "extra-borg-options". This seems to loose effect if borgmatic is called without --info switch (please see output below...).

Example for output of borg create --stats (called with borgmatic with --info switch):

...
Creating archive at "ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo::wolke-2025-03-17_01:05"
------------------------------------------------------------------------------
Repository: ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo
Archive name: wolke-2025-03-17_01:05
Archive fingerprint: ca253aabf973fdae9e8ecfaa2dcd6c64e043d8c86fc1286640bb2cd8c604d30a
Time (start): Mon, 2025-03-17 01:06:01
Time (end):   Mon, 2025-03-17 01:06:32
Duration: 30.84 seconds
Number of files: 202918
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:              449.88 GB            374.01 GB            285.16 MB
All archives:              186.91 TB            154.30 TB            669.10 GB
                       Unique chunks         Total chunks
Chunk index:                 1008512            170766059
------------------------------------------------------------------------------
terminating with success status, rc 0
...

Example for output of borg info (called with borgmatic) for same archive afterwards:

Archive name: wolke-2025-03-17_01:05
Archive fingerprint: ca253aabf973fdae9e8ecfaa2dcd6c64e043d8c86fc1286640bb2cd8c604d30a
Comment:
Hostname: xxxxx
Username: root
Time (start): Mon, 2025-03-17 01:06:01
Time (end): Mon, 2025-03-17 01:06:32
Duration: 30.84 seconds
Number of files: 202918
Command line: /usr/bin/borg create --patterns-from /tmp/borgmatic-3cpvsvi3/borgmatic/tmpcl39gqdb --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc --info --stats 'ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}'
Utilization of maximum supported archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:              449.88 GB            374.01 GB             63.52 MB
All archives:              187.03 TB            154.41 TB            669.92 GB
                       Unique chunks         Total chunks
Chunk index:                 1010741            170725306

And this is the output if invoked without "--verbosity 1/--info switch" and with borg info as a post backup hook (like in common.yaml):

Mi 19. Mär 12:32:33 CET 2025 +++ Starting backup to DS420 +++
Mi 19. Mär 12:33:16 CET 2025 +++ Finished backup to DS420 +++
DS420: Displaying archive summary information
Archive name: wolke-2025-03-19_12:32
Archive fingerprint: 5ac06c580d4b5e96bc90af46ca05b5cf45f4a6c657bc4b76d6e80d77cda732b4
Comment:
Hostname: xxxxx
Username: root
Time (start): Wed, 2025-03-19 12:32:34
Time (end): Wed, 2025-03-19 12:33:00
Duration: 26.12 seconds
Number of files: 203212
Command line: /usr/bin/borg create --patterns-from /tmp/borgmatic-zh0o0lam/borgmatic/tmppik05o_u --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc 'ssh://borguser@xxxxx/volume1/backups/BorgRepos/wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}'
Utilization of maximum supported archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:              450.33 GB            374.31 GB            177.71 MB
All archives:              186.65 TB            154.07 TB            671.22 GB
                       Unique chunks         Total chunks
Chunk index:                 1009997            170105902
Mi 19. Mär 12:34:44 CET 2025 +++ Starting backup to storagebox +++
Mi 19. Mär 12:35:15 CET 2025 +++ Finished backup to storagebox +++
storagebox: Displaying archive summary information
Archive name: wolke-2025-03-19_12:34
Archive fingerprint: 888a4eaba2cab8442c974d271ca564ff9d84e083e38c6dd0278203d927d1b28b
Comment:
Hostname: xxxxx
Username: root
Time (start): Wed, 2025-03-19 12:34:45
Time (end): Wed, 2025-03-19 12:35:11
Duration: 26.03 seconds
Number of files: 203212
Command line: /usr/bin/borg create --patterns-from /tmp/borgmatic-kyo58udb/borgmatic/tmpejv39qwi --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc 'ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}'
Utilization of maximum supported archive size: 0%
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
This archive:              450.33 GB            374.35 GB            178.19 MB
All archives:              187.48 TB            154.78 TB            669.95 GB
                       Unique chunks         Total chunks
Chunk index:                 1011018            171084761
.....

I only realized this behaviour because I removed the --verbosity 1 switch when invoking borgmatic (in my backup script) because it is the default anyway, right? So, maybe it could be a good idea than to set the --stats switch for borgmatic directly instead as a borg option? But anyway strange that the "extra-borg-options" only seem to work if the borgmatic --verbosity switch is set...

I am backing up to 2 different locations so there is a "common.yaml" with the general parameters for the backup and one config file for every location with the specific parameters. Please find the common.yaml attached. As you can see there I am passing the --stats and --show-rc as "extra-borg-options". This seems to loose effect if borgmatic is called without --info switch (please see output below...). Example for output of borg create --stats (called with borgmatic with --info switch): ``` ... Creating archive at "ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo::wolke-2025-03-17_01:05" ------------------------------------------------------------------------------ Repository: ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo Archive name: wolke-2025-03-17_01:05 Archive fingerprint: ca253aabf973fdae9e8ecfaa2dcd6c64e043d8c86fc1286640bb2cd8c604d30a Time (start): Mon, 2025-03-17 01:06:01 Time (end): Mon, 2025-03-17 01:06:32 Duration: 30.84 seconds Number of files: 202918 Utilization of max. archive size: 0% ------------------------------------------------------------------------------ Original size Compressed size Deduplicated size This archive: 449.88 GB 374.01 GB 285.16 MB All archives: 186.91 TB 154.30 TB 669.10 GB Unique chunks Total chunks Chunk index: 1008512 170766059 ------------------------------------------------------------------------------ terminating with success status, rc 0 ... ``` Example for output of borg info (called with borgmatic) for same archive afterwards: ``` Archive name: wolke-2025-03-17_01:05 Archive fingerprint: ca253aabf973fdae9e8ecfaa2dcd6c64e043d8c86fc1286640bb2cd8c604d30a Comment: Hostname: xxxxx Username: root Time (start): Mon, 2025-03-17 01:06:01 Time (end): Mon, 2025-03-17 01:06:32 Duration: 30.84 seconds Number of files: 202918 Command line: /usr/bin/borg create --patterns-from /tmp/borgmatic-3cpvsvi3/borgmatic/tmpcl39gqdb --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc --info --stats 'ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}' Utilization of maximum supported archive size: 0% ------------------------------------------------------------------------------ Original size Compressed size Deduplicated size This archive: 449.88 GB 374.01 GB 63.52 MB All archives: 187.03 TB 154.41 TB 669.92 GB Unique chunks Total chunks Chunk index: 1010741 170725306 ``` And this is the output if invoked **without** "--verbosity 1/--info switch" and with borg info as a post backup hook (like in common.yaml): ``` Mi 19. Mär 12:32:33 CET 2025 +++ Starting backup to DS420 +++ Mi 19. Mär 12:33:16 CET 2025 +++ Finished backup to DS420 +++ DS420: Displaying archive summary information Archive name: wolke-2025-03-19_12:32 Archive fingerprint: 5ac06c580d4b5e96bc90af46ca05b5cf45f4a6c657bc4b76d6e80d77cda732b4 Comment: Hostname: xxxxx Username: root Time (start): Wed, 2025-03-19 12:32:34 Time (end): Wed, 2025-03-19 12:33:00 Duration: 26.12 seconds Number of files: 203212 Command line: /usr/bin/borg create --patterns-from /tmp/borgmatic-zh0o0lam/borgmatic/tmppik05o_u --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc 'ssh://borguser@xxxxx/volume1/backups/BorgRepos/wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}' Utilization of maximum supported archive size: 0% ------------------------------------------------------------------------------ Original size Compressed size Deduplicated size This archive: 450.33 GB 374.31 GB 177.71 MB All archives: 186.65 TB 154.07 TB 671.22 GB Unique chunks Total chunks Chunk index: 1009997 170105902 Mi 19. Mär 12:34:44 CET 2025 +++ Starting backup to storagebox +++ Mi 19. Mär 12:35:15 CET 2025 +++ Finished backup to storagebox +++ storagebox: Displaying archive summary information Archive name: wolke-2025-03-19_12:34 Archive fingerprint: 888a4eaba2cab8442c974d271ca564ff9d84e083e38c6dd0278203d927d1b28b Comment: Hostname: xxxxx Username: root Time (start): Wed, 2025-03-19 12:34:45 Time (end): Wed, 2025-03-19 12:35:11 Duration: 26.03 seconds Number of files: 203212 Command line: /usr/bin/borg create --patterns-from /tmp/borgmatic-kyo58udb/borgmatic/tmpejv39qwi --exclude-caches --compression auto,zstd,3 --lock-wait 30 --stats --show-rc 'ssh://uxxxxx-sub1@uxxxxx.your-storagebox.de/./wolke_repo::{hostname}-{now:%Y-%m-%d_%H:%M}' Utilization of maximum supported archive size: 0% ------------------------------------------------------------------------------ Original size Compressed size Deduplicated size This archive: 450.33 GB 374.35 GB 178.19 MB All archives: 187.48 TB 154.78 TB 669.95 GB Unique chunks Total chunks Chunk index: 1011018 171084761 ..... ``` I only realized this behaviour because I removed the --verbosity 1 switch when invoking borgmatic (in my backup script) because it is the default anyway, right? So, maybe it could be a good idea than to set the --stats switch for borgmatic directly instead as a borg option? But anyway strange that the "extra-borg-options" only seem to work if the borgmatic --verbosity switch is set...
Owner

I'm not sure what's going on with the stats discrepancies you're seeing. What I'd recommend doing is seeing if you can reproduce it without borgmatic. You can do that by looking at the exact Borg commands borgmatic is running (via --verbosity 2) and then maybe adjusting for the excludes, since the temporary patterns files won't be available if copy-pasting those commands. If you can reproduce the stats discrepancy without borgmatic, then I think you have a case for filing a ticket upstream with the Borg project.

As for the other issues you're experiencing, can I get a look at your extra_borg_options configuration? It's possible there's a conflict or interaction between those options and the flags that borgmatic passes to Borg on its own. In general, I don't recommend putting any flags in extra_borg_options that borgmatic also sets. You may be interested in #790 and #793 if you're looking for a way to put some of these output-related options into the configuration file rather than having to specify them as flags on the command-line.

I'm not sure what's going on with the stats discrepancies you're seeing. What I'd recommend doing is seeing if you can reproduce it without borgmatic. You can do that by looking at the exact Borg commands borgmatic is running (via `--verbosity 2`) and then maybe adjusting for the excludes, since the temporary patterns files won't be available if copy-pasting those commands. If you can reproduce the stats discrepancy without borgmatic, then I think you have a case for filing a ticket upstream with the Borg project. As for the other issues you're experiencing, can I get a look at your `extra_borg_options` configuration? It's possible there's a conflict or interaction between those options and the flags that borgmatic passes to Borg on its own. In general, I don't recommend putting any flags in `extra_borg_options` that borgmatic also sets. You may be interested in #790 and #793 if you're looking for a way to put some of these output-related options into the configuration file rather than having to specify them as flags on the command-line.
Author

Ok, I will give that a try.

The extra_borg_options are --stats and --show-rc for create and prune as you can see in the common.yaml I uploaded. So, yes I could easily set the --stats flag as a borgmatic flag. But for --show-rc there is no borgmatic flag as you already mentioned. But therefore it should not hurt anyway, right?

Thanks for pointing me to the upcoming new action hooks. I will have a look at that.

And also a big THANK YOU anyway for your very swift support and effort. Much appreciated!

Ok, I will give that a try. The `extra_borg_options` are `--stats` and `--show-rc` for create and prune as you can see in the common.yaml I uploaded. So, yes I could easily set the `--stats` flag as a borgmatic flag. But for `--show-rc` there is no borgmatic flag as you already mentioned. But therefore it should not hurt anyway, right? Thanks for pointing me to the upcoming new action hooks. I will have a look at that. And also a big THANK YOU anyway for your very swift support and effort. Much appreciated!
Owner

If you want Borg to receive the --show-rc flag (and you don't mind passing flags to borgmatic's command-line and getting high verbosity output), all you need to do is use borgmatic --verbosity 2. You're right that it shouldn't hurt anything to use the extra_borg_options approach instead, but it does leave you responsible for making sure it's set individually for the right actions and also ensuring it interacts with the verbosity level as desired.

If you want Borg to receive the `--show-rc` flag (and you don't mind passing flags to borgmatic's command-line and getting high verbosity output), all you need to do is use `borgmatic --verbosity 2`. You're right that it shouldn't hurt anything to use the `extra_borg_options` approach instead, but it does leave you responsible for making sure it's set individually for the right actions and also ensuring it interacts with the verbosity level as desired.
iljur closed this issue 2025-03-21 15:32:30 +00:00
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1034
No description provided.