borgmatic prune don't work in the right way #824

Closed
opened 2024-02-07 14:21:51 +00:00 by barnybla · 5 comments

What I'm trying to do and why

after a long time I made a borgmatic list, and I saw there are too much backups. There are backups from 2022, 2023 and 2024.
So I tried:
borgmatic prune --keep-within 2m --list --stats

I get:
borgmatic: error: argument : invalid choice: '2m' (choose from .....

I would remove all backups before the last 2 month.

Steps to reproduce

No response

Actual behavior

No response

Expected behavior

No response

Other notes / implementation ideas

No response

borgmatic version

1.7.4

borgmatic installation method

pip install

Borg version

1.2.0

Python version

3.10.12

Database version (if applicable)

No response

Operating system and version

Ubuntu 22.04.3 LTS

### What I'm trying to do and why after a long time I made a borgmatic list, and I saw there are too much backups. There are backups from 2022, 2023 and 2024. So I tried: `borgmatic prune --keep-within 2m --list --stats` I get: `borgmatic: error: argument : invalid choice: '2m' (choose from .....` I would remove all backups before the last 2 month. ### Steps to reproduce _No response_ ### Actual behavior _No response_ ### Expected behavior _No response_ ### Other notes / implementation ideas _No response_ ### borgmatic version 1.7.4 ### borgmatic installation method pip install ### Borg version 1.2.0 ### Python version 3.10.12 ### Database version (if applicable) _No response_ ### Operating system and version Ubuntu 22.04.3 LTS
Owner

Thanks for filing this! All of the "keep" settings are options in your borgmatic configuration file; they aren't available as command-line arguments. So for instance you should be able to set keep_within: 2m in your borgmatic configuration, and then just run borgmatic prune --list --stats on the command-line. Let me know whether that does it for you!

Thanks for filing this! All of the "keep" settings are options in your borgmatic configuration file; they aren't available as command-line arguments. So for instance you should be able to set `keep_within: 2m` in your borgmatic configuration, and then just run `borgmatic prune --list --stats` on the command-line. Let me know whether that does it for you!
witten added the
question / support
label 2024-02-07 16:57:18 +00:00
Author

I put keep_within: 2m in the config.yaml:

without the "prune" action. See borgmatic documentation for details.

retention:
# Keep all archives within this time interval.
keep_within: 2m

Number of secondly archives to keep.

keep_secondly: 60

Then I made borgmatic prune --list --stats, then I get this:

root@mail2:~# borgmatic prune --list --stats
Keeping archive (rule: within #1): mail2-2024-02-07T00:01:11.551973 Wed, 2024-02-07 00:01:12 [5a97e17dd4c41f6958bfb0294e86a8176b57c9a466a7e4438bb9b632e3631a7a]
Keeping archive (rule: within #2): mail2-2024-02-06T00:01:32.008557 Tue, 2024-02-06 00:01:32 [dd17679c8e156af4b844c83c17ca996c7bcee8a3648c950615ca0d1e3030b609]
Keeping archive (rule: within #3): mail2-2024-02-05T00:01:20.884663 Mon, 2024-02-05 00:01:21 [e8f3a8cd0de08a891fae9ebdd486699f1f5c93001ac34cc484ab5ba2d7b8f2d3]
Keeping archive (rule: within #4): mail2-2024-01-28T00:01:18.850090 Sun, 2024-01-28 00:01:19 [ecf31d8bfa160c7286db3a228f349a6a3778ad390b533298a7af3f76e2fa0746]
Pruning archive (1/1): mail2-2024-01-07T00:01:18.617127 Sun, 2024-01-07 00:01:19 [26cf99d340ea36c4333188a4044ee753588bd93eb628ae32a0f17457ac5771e6]

                   Original size      Compressed size    Deduplicated size

Deleted data: -244.64 GB -244.64 GB -229.95 kB
All archives: 116.59 TB 116.03 TB 1.20 TB
Unique chunks Total chunks
Chunk index: 364003 46061527

root@mail2:~# borgmatic list
ssh://u298531@u298531.your-storagebox.de:23/./backups/mail2: Listing archives
2022_09_26_initial Mon, 2022-09-26 14:49:07 [cec1a320b8e9fa41087c550dc3d5991b9b8b77db5e84b41b1752e233052192ae]
2022_09_26_2_initial Mon, 2022-09-26 15:49:17 [aa072f969fc4a5436d1fc5db8cd250fef81b28ccf85939b9817925f20ed5ef33]
2022-10-02_13:54 Sun, 2022-10-02 15:55:00 [81e95878624e4edd1f283d84e3ec591643cc50761d86473b8ed6834d9cc1002e]
2022-10-03_01:05 Mon, 2022-10-03 03:05:05 [3d14d54512cfb886e94bd5ac1aa2481ae52f5dad774289852b92c71b86603ff2]
2022-10-04_03:05 Tue, 2022-10-04 05:05:06 [4728fd1f8f74d771f4a6afa66445054cbc0b493f6fa1f0b2336417fdd29a6b28]
2022-10-05_03:05 Wed, 2022-10-05 05:05:07 [1cf9f8b1a6337b0fc2f12701550a5db5ca52e5f43ad0c6743603bc0a1f48c9e2]
2022-10-06_03:05 Thu, 2022-10-06 05:05:05 [a18f745820d0dfc5e4ab0225b4ae4b29d0cbe2bcd8b9ab33f828802b8adf23b0]
2022-10-07_03:05 Fri, 2022-10-07 05:05:07 [a81c5ee897e7d1db35501639c21132aa83bc61b97cba1be2a7c7b8bce0efe8dc]

The command leave all the backups in the repository, I don't know why? I think normaly all backups before January and February must be deleted.

I put keep_within: 2m in the config.yaml: # without the "prune" action. See borgmatic documentation for details. retention: # Keep all archives within this time interval. keep_within: 2m # Number of secondly archives to keep. # keep_secondly: 60 Then I made borgmatic prune --list --stats, then I get this: root@mail2:~# borgmatic prune --list --stats Keeping archive (rule: within #1): mail2-2024-02-07T00:01:11.551973 Wed, 2024-02-07 00:01:12 [5a97e17dd4c41f6958bfb0294e86a8176b57c9a466a7e4438bb9b632e3631a7a] Keeping archive (rule: within #2): mail2-2024-02-06T00:01:32.008557 Tue, 2024-02-06 00:01:32 [dd17679c8e156af4b844c83c17ca996c7bcee8a3648c950615ca0d1e3030b609] Keeping archive (rule: within #3): mail2-2024-02-05T00:01:20.884663 Mon, 2024-02-05 00:01:21 [e8f3a8cd0de08a891fae9ebdd486699f1f5c93001ac34cc484ab5ba2d7b8f2d3] Keeping archive (rule: within #4): mail2-2024-01-28T00:01:18.850090 Sun, 2024-01-28 00:01:19 [ecf31d8bfa160c7286db3a228f349a6a3778ad390b533298a7af3f76e2fa0746] Pruning archive (1/1): mail2-2024-01-07T00:01:18.617127 Sun, 2024-01-07 00:01:19 [26cf99d340ea36c4333188a4044ee753588bd93eb628ae32a0f17457ac5771e6] ------------------------------------------------------------------------------ Original size Compressed size Deduplicated size Deleted data: -244.64 GB -244.64 GB -229.95 kB All archives: 116.59 TB 116.03 TB 1.20 TB Unique chunks Total chunks Chunk index: 364003 46061527 ------------------------------------------------------------------------------ root@mail2:~# borgmatic list ssh://u298531@u298531.your-storagebox.de:23/./backups/mail2: Listing archives 2022_09_26_initial Mon, 2022-09-26 14:49:07 [cec1a320b8e9fa41087c550dc3d5991b9b8b77db5e84b41b1752e233052192ae] 2022_09_26_2_initial Mon, 2022-09-26 15:49:17 [aa072f969fc4a5436d1fc5db8cd250fef81b28ccf85939b9817925f20ed5ef33] 2022-10-02_13:54 Sun, 2022-10-02 15:55:00 [81e95878624e4edd1f283d84e3ec591643cc50761d86473b8ed6834d9cc1002e] 2022-10-03_01:05 Mon, 2022-10-03 03:05:05 [3d14d54512cfb886e94bd5ac1aa2481ae52f5dad774289852b92c71b86603ff2] 2022-10-04_03:05 Tue, 2022-10-04 05:05:06 [4728fd1f8f74d771f4a6afa66445054cbc0b493f6fa1f0b2336417fdd29a6b28] 2022-10-05_03:05 Wed, 2022-10-05 05:05:07 [1cf9f8b1a6337b0fc2f12701550a5db5ca52e5f43ad0c6743603bc0a1f48c9e2] 2022-10-06_03:05 Thu, 2022-10-06 05:05:05 [a18f745820d0dfc5e4ab0225b4ae4b29d0cbe2bcd8b9ab33f828802b8adf23b0] 2022-10-07_03:05 Fri, 2022-10-07 05:05:07 [a81c5ee897e7d1db35501639c21132aa83bc61b97cba1be2a7c7b8bce0efe8dc] The command leave all the backups in the repository, I don't know why? I think normaly all backups before January and February must be deleted.
Owner

I'm seeing that the archives getting considered for pruning start with mail2-, while the archives that aren't considered don't have that prefix. borgmatic automatically filters the set of considered archives based on your configured archive_name_format (whether set explicitly or or not). You can override this behavior and ask borgmatic to consider all archives by setting the match_archives: * option or changing the value of archive_name_format accordingly.

Documentation on this feature: https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#archive-naming

The purpose of this feature is to prevent borgmatic from touching archives that it's not responsible for managing. E.g., archives made by another application, script, or even a separate borgmatic configuration file.

I'm seeing that the archives getting considered for pruning start with `mail2-`, while the archives that aren't considered don't have that prefix. borgmatic automatically filters the set of considered archives based on your configured `archive_name_format` (whether set explicitly or or not). You can override this behavior and ask borgmatic to consider _all_ archives by setting the `match_archives: *` option or changing the value of `archive_name_format` accordingly. Documentation on this feature: https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#archive-naming The purpose of this feature is to prevent borgmatic from touching archives that it's not responsible for managing. E.g., archives made by another application, script, or even a separate borgmatic configuration file.
Author

Î tried once more with borg prune -v --list --keep-daily=7 ssh://u2988....., and that was working. Now it works automatically.

Thanks

Î tried once more with borg prune -v --list --keep-daily=7 ssh://u2988....., and that was working. Now it works automatically. Thanks
Owner

Glad to hear it's working for you now!

Glad to hear it's working for you now!
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#824
No description provided.